instance method update_attribute

Ruby on Rails 2.3.18

Since v2.2.3 Last seen in v2.3.18

Available in: v2.2.3 v2.3.18

Signature

update_attribute(name, value)

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.

Parameters

name req
value req
Source
# File activerecord/lib/active_record/base.rb, line 2667
      def update_attribute(name, value)
        send(name.to_s + '=', value)
        save(false)
      end

Defined in activerecord/lib/active_record/base.rb line 2667 · 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