Rails

Jul
14th
09

application.rb renamed application _controller.rb in rails 2.3

I recently had an issue with a rails app working fine locally under rails 2.3.2 but failing when deployed to Media Temple’s Grid Service.

I got the error:

custom_require.rb:31:in `gem_original_require’: no such file to load — application (MissingSourceFile) etc etc

This turned out to be due to this change in the rails core. the previous application controller class ApplicationController, was kept in application.rb in the controllers folder. This is of course inconsistent, so they moved it to application_controller.rb.

To Fix, rename your application_controller.rb to application.rb

I’m not sure why Media Temple’s Rails 2.3.2 is different from mine, but anyway, perhaps this will help someone out.


Jul
13th
09

Checking variables in Rails

Checking for empty / nill / null values in rails can be a bit confusing and can make your code a bit of a mess checking for nil or empty variables.

Rails provides a utility method “blank” to check if a variable has anything in it.

An object is blank if it‘s false, empty, or a whitespace string. For example, “”, ” “, nil, [], and {} are blank.
(more…)