Module: ActiveRecord::Dirty::ClassMethods

Defined in:
lib/active_record/dirty.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



169
170
171
# File 'lib/active_record/dirty.rb', line 169

def self.extended(base)
  base.metaclass.alias_method_chain(:alias_attribute, :dirty)
end

Instance Method Details

#alias_attribute_with_dirty(new_name, old_name) ⇒ Object



173
174
175
176
177
178
179
180
# File 'lib/active_record/dirty.rb', line 173

def alias_attribute_with_dirty(new_name, old_name)
  alias_attribute_without_dirty(new_name, old_name)
  DIRTY_SUFFIXES.each do |suffix|
    module_eval <<-STR, __FILE__, __LINE__+1
      def #{new_name}#{suffix}; self.#{old_name}#{suffix}; end
    STR
  end
end