instance method
update_attribute
Ruby on Rails 2.2.3
Since v2.2.3 Last seen in v2.3.18Available 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
-
namereq -
valuereq
Source
# File activerecord/lib/active_record/base.rb, line 2463
def update_attribute(name, value)
send(name.to_s + '=', value)
save(false)
end
Defined in activerecord/lib/active_record/base.rb line 2463
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::Base