instance method restore_attribute!

Ruby on Rails 7.0.10

Since v4.2.9 Private

Available in: v4.2.9 v5.2.8.1 v6.0.6 v6.1.7.10 v7.0.10 v7.1.6 v7.2.3 v8.0.4 v8.1.2

Signature

restore_attribute!(attr_name)

Dispatch target for restore_*! attribute methods.

Parameters

attr_name req
Source
# File activemodel/lib/active_model/dirty.rb, line 286
      def restore_attribute!(attr_name)
        attr_name = attr_name.to_s
        if attribute_changed?(attr_name)
          __send__("#{attr_name}=", attribute_was(attr_name))
          clear_attribute_change(attr_name)
        end
      end

Defined in activemodel/lib/active_model/dirty.rb line 286 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveModel::Dirty

Type at least 2 characters to search.

↑↓ navigate · open · esc close