While using the in place editor, I noticed that none of my validations were firing. Digging around in the docs I found that this is deliberate.
This method is overwritten by
the Validation module that’ll make sure that updates made with this
method doesn’t get subjected to validation checks. Hence, attributes
can be updated even if the full object isn’t valid.
In the validations module,
alias_method_chain :update_attribute, :validation_skipping
# Updates a single attribute and saves the record without going through the normal validation procedure. # This is especially useful for boolean flags on existing records. The regular +update_attribute+ method # in Base is replaced with this when the validations module is mixed in, which it is by default. def update_attribute_with_validation_skipping(name, value) send(name.to_s + '=', value) save(false) end
Why would validations be turned off by default when using in place editors? and also why would update_attribute have validation turned off by default with no apparent way of turning it back on?
Can anyone explain this to me please.