Module: ActiveAttr::Dirty::ClassMethods

Defined in:
lib/active_attr/dirty.rb

Instance Method Summary collapse

Instance Method Details

#attribute!(name, options = {}) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/active_attr/dirty.rb', line 12

def attribute!(name, options={})
  super(name, options)
  define_method("#{name}=") do |value|
    send("#{name}_will_change!") unless value == read_attribute(name)
    super(value)
  end
end