ruby-on-rails

Research: Looking for OpenSource Rails App mit performance issues

Hi, I'm looking for an open source web application written in ruby on rails, that have had (or still have!) some performance issues in the past. I'd like to carry out some tests on it during my thesis. Thx for any hints! ...

How to stop a Daemon Server in Rails ?

Hi I am running my rails application using the following $script/server -d webrick on my Ubuntu system , above command run the webrick server in background . I could kill the process using kill command $kill pid Does rails provide any command to stop the background running daemon server ? like the one provided by rail...

Rendering a collection of different classes in Rails

I have a collection that contains instances of several different classes, and I want to render the partial for each instance. I can do this using the following code: <%= render @results %> My question is: How can I render the different partials in a different base directory? The above code will look for app/views/stories/_story.html.e...

If we cache params into a local var in an action, will it help or its the same?

So we run a code quality tool called reek once in a while as part of our project. The tool basically looks for code smells and reports them. Here, we observed that we get "Duplication" smell every time we try to access a key in params more than once (As if we are making a method-call twice with same parameters or we are duplicating an if...

When I run script/console in my rails app, I got error readline.bundle

I have problem with running 'script/console' Environments os : macosx ruby version : ruby 1.8.7p5000 (2009-03-03) [i386-darwin9.6.0] rails version : Rails 2.3.2 Loading development environment (Rails 2.2.2) /usr/local/lib/ruby/1.8/i386-darwin9.6.0/readline.bundle: dlopen(/usr/local/lib/ruby/1.8/i386-darwin9.6.0/readline.bundle, ...

Testing HTTP Basic Auth in Rails 2.2+

As part of an API I am building, there is a user authentication method which upon success, returns a payload of useful user information, API token, etc. In writing functional tests for the controller that handles this, I am running in to an issue testing HTTP Basic auth; I have found numerous blogs that mention the following code should...

What would be the easiest way to get a tree / treeview like control on my Rails view ?

In the desktop world, it would be a treeviewcontrol.nodes = @nodes However I'm doing a prototype using rails and I have the hierarchy loaded as a bunch of nested MyNode objects. My intent is to display this as a tree, the user can expand or collapse nodes as needed. I didn't find a pure Rails solution - seems like the idea is to use AJ...

Pair of blocks in each?

As in the standart cycle: - @goods.each do |good| ??? ...to organize this (HAML): .columns-wrapper .column First good .column Second good .column Third good .columns-wrapper .column Fourth good .column Fifth good .column Sixth good ...

Rails Development and Cygwin on Windows XP

Hello I installed cygwin on Windows XP so I can use Unix command in Console2. I also installed Ruby on Rails without much of problem. Then I tried to run the 'ruby /script/server' command, and I got the following error: $ ruby /script/server c:\ruby\bin\ruby.exe: No such file or directory -- /script/server (LoadError) In order to acc...

Rails, losing flash after redirect_to

Hello, I can't figure out why my flash messages disappear after a redirect_to. Started the debugger in my view, and the flash variable is totally empty. flash => {} The result is the same with flash.now... It works fine if I edit something and call render. Controller: def create @user_session = UserSession.new(params[:user_s...

Rails3 structure, engines, plugins, slices, gems, modules.. ?

Do you have a working example of a Rails3 mvc application? How will it be organized? I hope something like: -app --controller --views -plugins --myapp1 ---app ---controller ---views ---... Can app1 use a model from app2? Will "routes" file be deprecated? reference: [h ttp://yehudakatz.com/2009/07/19/rails-3-the-great-decoupling][1...

How do I get Rails to stop re-loading my gems?

I have a gem: # in /Library/Ruby/Gems/1.8/gems/my_gem-1.0.0/lib/my_gem.rb module MyGem def do_stuff .. end end And I loaded it in Rails: # in [rails_root]/config/environment.rb: config.gem 'my_gem', :version => '1.0.0' And used it: # in [rails_root]/app/controllers/application_controller.rb class ApplicationController < Ac...

Sitewide authentication error - only in IE7/8

Have a restful authentication, rails 2.2.2 app I'm getting ready to launch, but getting weird behavior when I hit the site from IE7 or 8 (not FF 3.5, 3, Mac or PC): hitting the domain http://startuptodo.com in IE7 gets you an IE dialog: Connect to startuptodo.com the server startuptodo.com at Web Password requires a username and passwor...

Where are the logs for a Rails app packed using Warbler?

I'm using Warbler to pack a Rails application into a WAR. I've deployed it to a JBoss server and it seems to works. However, I'm getting the classic 500 error on Rails saying "We're sorry, but something went wrong.". Usually, I'd take a look at logs/production.log to find out what's wrong, but since the project is WARed, I can't access...

transform datetime into local time in Ruby on Rails

Right now I have: Time.strftime("%I:%M%p") which gives me the hr:min AM/PM format which I need. However it's coming back in UTC and I need it local time zone. How do I change it to local time zone and keep that same format for time? ...

is Ruby here to stay?

Ruby on Rails has made a rapid rise as decent language for webdevelopment. How does it compare to other languages in that area (PHP, Perl, Java, VB.NET, ...) from a webdevelopment perspective? Will the number of sites programmed with Ruby keep rising or has its popularity brought up issues that may keep it from becoming a keeper (eg spee...

Do you find convention over configuration good or bad?

I did a fair amount of experimenting with Ruby on Rails and its convention over configuration, which gave me a lot of functionality automatically. But later I found that I wasn't sure I like the paradigm. It seemed to get in the way when dealing with my database and having to make sure everything was named just so, etc. Is there a hug...

(Rails) How do I mimic Finder/Explorer views with contextual menus, etc?

Hi All, I'm looking for some quality techniques for mimicking a Finder (or "Explorer View"). Eventually I want to have treeviews, contextual menus, etc. I'm guessing there is going to be a good deal of Javascript, which is fine, I'm just curious as to whether there are quality existing helpers, etc for any of these things. The curren...

How to crop & fill with Paperclip (or RMagick) ?

I upload a photo, it is a rectangle. How Can I get it resized and filled to a square ? I mean when the photo is horizontal positioned it should have above and under it, two white fields (for keeping the shape of a square) and when it is vertically, it should have two white fields on the sides of the photo. When I used PHP, a have used ...

Auto Complete Fields in Rails that Display Something Different Than What They Select

Hi, I'm trying to create an auto complete field (using the script.aculo.us plugin) in a form for a category select, but I want the auto complete list to display a number next to each category (the number of other things in the same category). This is similar to the Tags field on stack overflow. Right now I can display the number I wa...