Flowdock

Notes posted by spectator

RSS feed
October 15, 2009
4 thanks

Have check_box checked by default

In addition to comment below, you can make a column with default value so in your forms it will be enabled by default and behave correctly with validation errors unlike :checked => true

in your migration

add_column :accounts, :ssl_enabled, :boolean, :default => 1
November 28, 2008 - (>= v2.2.1)
2 thanks

Removed form Rails core

country_select and country_options_for_select were removed from Rails core since 2.2 release, but extracted to plugin. http://github.com/rails/country_select/tree/master/README

Also you could be interested in localized_country_select plugin which uses Rails internationalization framework I18n. http://github.com/karmi/localized_country_select/tree/master/README.rdoc

July 24, 2008
8 thanks

render template file different from your action (method) name

In some cases you have to avoid rails magic that uses template names named as your ActionMailer method.

rails magic

def daily_notification
  # ...
end
# will look for daily_notification.erb

def weekly_notification
  # ...
end
# will look for weekly_notification.erb

your case

Just give necessary value to @template instance variable.

def setup
  # ...
  @template = 'notification'
end

def daily_notification
  # ...
end
# will look for notification.erb

def weekly_notification
  # ...
end
# will look for notification.erb