Displaying 1 result from an estimated 1 matches for "ensure_boolean_value_for_finalized".
2007 Apr 05
0
unexpected behavior of before_validation
...s will be aborted and Base#save will
return false.
# If Base#save! is called it will raise a RecordNotSave error.
# Nothing will be appended to the errors object.
This caused me a lot of frustration earlier when I was trying to get a
model with the following code to save:
before_validation :ensure_boolean_value_for_finalized
private
def ensure_boolean_value_for_finalized
self.finalized = false unless self.finalized
end
I''m wondering why before_validation will abort the process of saving.
My conception of before_validation was that its purpose was only to
prepare the model object for validation, and...