Displaying 1 result from an estimated 1 matches for "can_still_regist".
Did you mean:
can_still_register
2005 Dec 30
2
before_create question
...on belongs_to User and Registration. So far, so good.
There''s a registration deadline on a Event though, a few days before
the Event occurs.
So, I have this:
class Registration < AR
def before_create
errors.add_to_base("Registration deadline has passed") unless
event.can_still_register?
end
end
The weird thing is, if the registration deadline has passed, the error
gets added to the registration object, and calling save! throws no
exception, but the registration object doesn''t get saved.
So, this test code throws no exception:
event = TrainingEvent.new :start_d...