Displaying 9 results from an estimated 9 matches for "validates_date".
2006 Mar 10
19
validates_date plugin for ActiveRecord
This plugin gives ActiveRecord the ability to do stricter date checking.
Example:
class Person < ActiveRecord::Base
validates_date :date_of_birth
end
This will ensure that date_of_birth is a *valid* date. The date can be set
initially as a string in any of the following formats:
"2006-01-01"
"1 Jan 06", or "1 Jan 2006"
"1/1/06" # Day / Month / Year
They will all be parsed int...
2006 Aug 11
4
date (age) validation
I have an application that requires users to be in a specific age group,
or above a certain age. For simplicity sake lets say they have to be at
least 18.
This is my most recent attempt to produce the desired result:
validates_exclusion_of :birthday, :in => Range.new(Date.today,
Date.parse( (18.years.ago).strftime(''%Y/%m/%d'') )),
:message => "does not meet
2006 Apr 09
6
Validating a DateTime
Hi,
Does anyone know of a method to validate a DateTime field?
I''ve looked at the validation docs and the validates_date /
validates_time plug-in but I can''t find a method to validate a value in
the format of yyyymmddhhmm. It seems like something that should exist
already, so I''d just like to check before I attempt my own version...
Cheers,
Mark
2008 Apr 25
0
Date validation :before -1 day
I really liked the tool but I have got stuck in one case. I am in urgent
need of your help regarding
validates_date :sale_start, :before => :sale_end,
:after => Proc.new { -1.day.from_now.to_date }
validates_date :sale_end, :after => [:sale_start ,
Proc.new {
-1.day.from_now.to_date }],
This is Okay but there may be the same date as of s...
2007 Aug 12
4
Date and Time validator, updater
Can someone point me to a date/time validator or updater.
I have an event start datetime and an event end datetime. I want
to validate that the end datetime is after the start datetime.
Figure there is some code or library out there already, if you
know one, please forward it.
Thank you!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are
2005 Aug 04
0
Rails Date/Time Validation and Parsing
I''m kind of getting my brain around Rails''ey things. Dates are an annoyance
no matter what the language, but in keeping with DRY, I''m looking for
something like:
validates_date :between => 4/8/2002..5/29/2009
Or something like that.
Additionally, it seems someone somewhere must have created a wrapper around
strtotime. What I''m looking for is a way to parse nearly any valid date
entry into a Date type.
Thanks,
Steve Ross
2008 Aug 31
6
why's my course_duration being reset
...when 5..12
0.9
when 13..24
0.8
when 25..47
0.7
else # from 48 and up
0.5
end
self.course_fee = (self.course_fee * @factor)
self.total_fee = course_booking_fee + accommodation_booking_fee +
course_fee + accommodation_fee
end
validates_date :date_of_birth, :requested_start_date
validates_presence_of :title,
:firstname,
:surname,
:address1,
:phone,
:country,
:nationality,...
2008 Sep 24
2
Thinking_sphinx indexing problem on production
Hello,
I have been using Sphinx with Thinking_sphinx plugin which works well on
local development environment, but once I move it to production (shared
host) I get this error and I''m not sure why
linkamed-sE8khXQTlBmcZ8xLbwwaNw@public.gmane.org [~/public_html/linko/current/config]# rake
thinking_sphinx:index RAILS_ENV=production
(in
2006 Jul 13
3
date_helper megapatch and MultiparameterAssignmentErrors
Hello all,
There''s a great patch in trac that fixes a lof of issues with the
date helpers. I''m afraid it hasn''t had any attention yet.
http://dev.rubyonrails.org/ticket/3811
This fixes all the little date_helper problems, except one: When you
choose an invalid date ActiveRecord throws an
ActiveRecord::MultiparameterAssignmentErrors. This used to work in
1.0,