Module: Content::ItemDirtyMethods::ClassMethods

Defined in:
lib/content/item_dirty_methods.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



157
158
159
# File 'lib/content/item_dirty_methods.rb', line 157

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



161
162
163
164
165
166
167
168
# File 'lib/content/item_dirty_methods.rb', line 161

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  # def subject_changed?; self.title_changed?; end
    STR
  end
end