instance method toggle!

Ruby on Rails 2.2.3

Since v2.2.3 Last seen in v2.3.18

Available in: v2.2.3 v2.3.18

Signature

toggle!(attribute)

Wrapper around toggle that saves the record. This method differs from its non-bang version in that it passes through the attribute setter. Saving is not subjected to validation checks. Returns true if the record could be saved.

Parameters

attribute req
Source
# File activerecord/lib/active_record/base.rb, line 2528
      def toggle!(attribute)
        toggle(attribute).update_attribute(attribute, self[attribute])
      end

Defined in activerecord/lib/active_record/base.rb line 2528 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveRecord::Base

Type at least 2 characters to search.

↑↓ navigate · open · esc close