Sha256: 0cb4e27835249ed92ae70a59efe9e1df74a5532db465fd0d698c7e9dec5884c3

Contents?: true

Size: 1.26 KB

Versions: 259

Compression:

Stored size: 1.26 KB

Contents

module ActsAsTaggableOn::Taggable
  module Dirty
    def self.included(base)
      base.extend ActsAsTaggableOn::Taggable::Dirty::ClassMethods
      
      base.initialize_acts_as_taggable_on_dirty
    end
    
    module ClassMethods
      def initialize_acts_as_taggable_on_dirty
        tag_types.map(&:to_s).each do |tags_type|
          tag_type         = tags_type.to_s.singularize
          context_tags     = tags_type.to_sym
          
          class_eval %(
            def #{tag_type}_list_changed?
              changed_attributes.include?("#{tag_type}_list")
            end
            
            def #{tag_type}_list_was
              changed_attributes.include?("#{tag_type}_list") ? changed_attributes["#{tag_type}_list"] : __send__("#{tag_type}_list")
            end
            
            def #{tag_type}_list_change
              [changed_attributes['#{tag_type}_list'], __send__('#{tag_type}_list')] if changed_attributes.include?("#{tag_type}_list")               
            end
            
            def #{tag_type}_list_changes
              [changed_attributes['#{tag_type}_list'], __send__('#{tag_type}_list')] if changed_attributes.include?("#{tag_type}_list")               
            end
          )
          
        end
      end
    end
  end
end

Version data entries

259 entries across 259 versions & 4 rubygems

Version Path
social_stream-0.28.4 base/lib/acts_as_taggable_on/acts_as_taggable_on/dirty.rb
social_stream-base-0.22.4 lib/acts_as_taggable_on/acts_as_taggable_on/dirty.rb
social_stream-0.28.1 base/lib/acts_as_taggable_on/acts_as_taggable_on/dirty.rb
social_stream-base-0.22.1 lib/acts_as_taggable_on/acts_as_taggable_on/dirty.rb
social_stream-0.28.0 base/lib/acts_as_taggable_on/acts_as_taggable_on/dirty.rb
social_stream-base-0.22.0 lib/acts_as_taggable_on/acts_as_taggable_on/dirty.rb
social_stream-0.27.3 base/lib/acts_as_taggable_on/acts_as_taggable_on/dirty.rb
social_stream-0.27.2 base/lib/acts_as_taggable_on/acts_as_taggable_on/dirty.rb
social_stream-base-0.21.2 lib/acts_as_taggable_on/acts_as_taggable_on/dirty.rb
social_stream-0.27.1 base/lib/acts_as_taggable_on/acts_as_taggable_on/dirty.rb
social_stream-base-0.21.1 lib/acts_as_taggable_on/acts_as_taggable_on/dirty.rb
social_stream-0.27.0 base/lib/acts_as_taggable_on/acts_as_taggable_on/dirty.rb
social_stream-base-0.21.0 lib/acts_as_taggable_on/acts_as_taggable_on/dirty.rb
social_stream-0.26.2 base/lib/acts_as_taggable_on/acts_as_taggable_on/dirty.rb
social_stream-base-0.20.2 lib/acts_as_taggable_on/acts_as_taggable_on/dirty.rb
social_stream-0.26.1 base/lib/acts_as_taggable_on/acts_as_taggable_on/dirty.rb
social_stream-base-0.20.1 lib/acts_as_taggable_on/acts_as_taggable_on/dirty.rb
social_stream-0.26.0 base/lib/acts_as_taggable_on/acts_as_taggable_on/dirty.rb
social_stream-base-0.20.0 lib/acts_as_taggable_on/acts_as_taggable_on/dirty.rb
social_stream-0.25.2 base/lib/acts_as_taggable_on/acts_as_taggable_on/dirty.rb