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