Module: ActiveAttr::Dirty::ClassMethods

Defined in:
lib/active_attr/dirty.rb

Overview

Class methods for ActiveAttr::Dirty module

Instance Method Summary collapse

Instance Method Details

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

Overwritten attribute! method

Parameters:

  • name (Symbol)
  • options (Hash) (defaults to: {})


17
18
19
20
21
22
23
# File 'lib/active_attr/dirty.rb', line 17

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