Re: [Rails] Validations question

2010-03-05 Thread Andy Jeffries
validate :start_date_should_not_be_greater_than_current_date Personally I'd rename that to: valid :start_date_before_now And then I'd do this as the method: def start_date_before_now if start_date start_date Date.today errors.add(Whatever) end end Just check start_date first.

[Rails] Validations question

2010-03-04 Thread Hemant Bhargava
I have wrote an validation function for checking that my starting date should be greater than the current date as like validate :start_date_should_not_be_greater_than_current_date def start_date_should_not_be_greater_than_current_date if self.start_date Date.today errors.add(Whatever)

[Rails] Validations Question

2008-11-18 Thread Jables
I have a script that is run by a cron job. It is constantly trying to put the same records into the database plus a few unique ones so to solve this I put a validates_uniqueness_of :title on the model. This has the desired effect but the script exits with error on a invalid validation