Hi, you can try using the following:
http://www.railsonwave.com/railsonwave/2006/12/13/howto-validate-date-format-in-ruby-on-rails
or
valid_date?
Good luck,
-Conrad
On 1/7/07, Jason Vogel
<jasonvogel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:>
> View [actually in a partial]...
>
> <td>
> <%= date_select
''contract_payment'',
''credit_card_expiration_date'',
> { :order => [:month, :year], :start_year =>
2006, :end_year => 2020,
> :use_month_numbers => true,
> :discard_day => true, :include_blank => true
} %>
> </td>
>
> Model :
>
> validates_presence_of :credit_card_expiration_date,
> :credit_card_number
>
> This is not right. The View renders correctly (minus the hard-coded
> 2006... not sure yet how to replace that].
>
> I want to make the month and year [sub-]fields required. I also want
> them to be greater than today. The "validates_presence_of"
doesn''t
> handle both the month and year correctly.
>
> I would really appreciate an example.
>
> Thanks,
> Jason
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---