Ruby on Rails Wednesday, February 1, 2012

On 1 February 2012 09:24, sandip ransing <sandip@funonrails.com> wrote:
> Hi Peter,
>
> validating date against Date.strptime('DATE STRING') will surely work.
> At controller level, i can able to do validation on date but at model level
> it goes for toss bcz value gets nil before validation(at assignment level)

The best thing is not to let the user enter a simple string for the
date, but give him different fields for day, month and year and then
combine them into a date. Allowing him to enter it as a string will
cause problems as different users will expect different ordering of
the date. I generally use date_select for dates as Rails will
automatically combine the form fields for you.

Colin

--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment