Aldric Giacomoni wrote:
> Philip Hallstrom wrote:
>> 
>> If it were me... I'd default the date to today, and leave location 
>> blank.  Defaulting the date to today makes some sense as 6 months from 
>> now if I'm searching I'll remember "well, i entered it about 6 months 
>> ago so search around then".
>> 
> 
> So.. How should I tell Rails that "This field's default date is always 
> today" ? Can I do this within the migration, or should I set the field 
> upon form generation?

Well, if it were a constant default value, I would say that you should 
set it in the DB, not in Rails.  Since "today" is a computed default 
value, check whether your DB will do this.  If it will, you're home 
free.

If not...well, you're using form_for, right?  That means you always have 
an object that your form is reading from, right?  That means you can 
initialize defaults in the constructor.
-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to