Displaying 1 result from an estimated 1 matches for "datecallback".
Did you mean:
datecallbacks
2006 Jun 15
1
callback object problem
I''m trying to create a separate class to do validation so that about 10
models can use the same date validation. I have tried to use the
example from the agile book but it''s not working. Here''s what I have:
app/models/date_callbacks.rb
class DateCallbacks
def before_validation(model)
if model.start_date > Date.today
model.errors.add(:start_date, "must be before today")
end
if !model.end_date.nil?
if model.end_date > Date.today
model.errors.add(:end_date, "must be before today")
end
end
if !model....