Notes posted by morgoth

RSS feed
April 1, 2010
0 thanks

Fetching records when column is set to nil or false

If you want to fetch all records when one column (boolean) is set to nil or false, try this:

Project.all(:conditions => "archived IS NULL OR archived = 'f'")
March 19, 2010
1 thank

singular_class_name method missing

If this method is undefined in ActionView::Base, add to your ApplicationController:

class ApplicationController < ActionController::Base
  helper_method :singular_class_name
end
May 8, 2009
2 thanks

Using gmail SMTP server to send mail

If you’re running Rails >= 2.2.1 [RC2] and Ruby 1.8.7, you don’t need plugin below. Ruby 1.8.7 supports SMTP TLS and Rails 2.2.1 ships with an option to enable it if you’re running Ruby 1.8.7.

All You need to do is:

ActionMailer::Base.smtp_settings = {
  :enable_starttls_auto => true
}
September 15, 2008 - (<= v2.1.0)
9 thanks