You can do this in the controller, but I’d advise against this.
Why? Business logic is best located and/or managed by the model. The
easiest way to do this would be to modify the database column to set a
default value, which Active Record will read when it looks at the
table structure and use this to set default values.
For example, if you had a migration for a new field, you could do the
add_column :teams, :active, :boolean, :default => false
If we had a Team model, when we did Team.new, we’d see that there
would be a default value already set for the active attribute.
As mentioned, this would be the simplest method and would keep the
business logic located in the realm of the model. Keep controller code
short and sweet.
Hope this helps!
On Wed, Apr 22, 2009 at 8:09 PM, Franco C. firstname.lastname@example.org
The simplest way would be to have a check_box that defaults to checked
Chief Evangelist, Partner
PLANET ARGON, LLC
design // development // hosting w/Ruby on Rails
+1 503 445 2457
+1 877 55 ARGON [toll free]
+1 815 642 4068 [fax]