How to update attributes without validation How to update attributes without validation ruby-on-rails ruby-on-rails

How to update attributes without validation


You can do something like:

object.attribute = valueobject.save(:validate => false)


USE update_attribute instead of update_attributes

Updates a single attribute and saves the record without going through the normal validation procedure.

if a.update_attribute('state', a.state)

Note:- 'update_attribute' update only one attribute at a time from the code given in question i think it will work for you.


try using

@record.assign_attributes({ ... })@record.save(validate: false)

works for me