instance method
toggle!
Ruby on Rails 6.1.7.10
Since v3.0.20Signature
toggle!(attribute)
Wrapper around #toggle that saves the record. This method differs from its non-bang version in the sense that it passes through the attribute setter. Saving is not subjected to validation checks. Returns true if the record could be saved.
Parameters
-
attributereq
Source
# File activerecord/lib/active_record/persistence.rb, line 748
def toggle!(attribute)
toggle(attribute).update_attribute(attribute, self[attribute])
end
Defined in activerecord/lib/active_record/persistence.rb line 748
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::Persistence