Method: Cylons::Attributes#write_attribute
- Defined in:
- lib/cylons/attributes.rb
#write_attribute(name, value) ⇒ Object Also known as: []=, attribute=
Override #write_attribute (along with #[]=) so we can provide support for ActiveModel::Dirty.
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/cylons/attributes.rb', line 17 def write_attribute(name, value) __send__("#{name}_will_change!") if value != self[name] name = name.to_s if @attributes.has_key?(name) || self.respond_to?(name) @attributes[name] = value else raise ::ActiveAttr::UnknownAttributeError, "unknown attribute: #{name}" end end |