Re: Validating DateHelpers date_select

Doug Alcorn
Thu, 26 May 2005 18:51:32 -0000

John Kopanas <john.kopanas-O1KSuMybMhqBUy7/sJONFg@public.gmane.org>
writes:

> How would I go about validating that in a rails way.

My solution is like this:

  validates_inclusion_of :dob, :in => Date.new(1930)..18.years.ago.to_date,
:message => "Must be born between 1930 and
#{18.years.ago.strftime(''%Y'')}"

The 1930 thing is kind of arbitrary though, but this doesn''t require
extending AR.
--
doug-jGAhs73c5XxeoWH0uzbU5w@public.gmane.org