instance method
save_changed_attribute
Ruby on Rails 4.1.16
Since v4.1.16 Last seen in v4.2.9 PrivateAvailable in: v4.1.16 v4.2.9
Signature
save_changed_attribute(attr_name, value)
No documentation comment.
Parameters
-
attr_namereq -
valuereq
Source
# File activerecord/lib/active_record/enum.rb, line 141
def save_changed_attribute(attr_name, value)
if (mapping = self.class.defined_enums[attr_name.to_s])
if attribute_changed?(attr_name)
old = changed_attributes[attr_name]
if mapping[old] == value
changed_attributes.delete(attr_name)
end
else
old = clone_attribute_value(:read_attribute, attr_name)
if old != value
changed_attributes[attr_name] = mapping.key old
end
end
else
super
end
end
Defined in activerecord/lib/active_record/enum.rb line 141
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::Enum