Sha256: aeab9d81f0bf6f4e96986d0e4d94ff9f039eea5581d0012ed9d7b6b47a4fd772

Contents?: true

Size: 548 Bytes

Versions: 4

Compression:

Stored size: 548 Bytes

Contents

module MyTags::ActiveRecord
  def self.included(base)
    base.extend MyTags::ActiveRecord::ClassMethods
  end

  def tag_list
    @tag_list ||= MyTags::TagList.new self
  end

  def tag_list=(names)
    @tag_names = names.is_a?(MyTags::TagList) ? names : MyTags::TagList.new_with_names(self, names)
  end

  module ClassMethods
    def has_many_tags
      has_many :taggings, :class_name => 'MyTags::Tagging', :as => :taggable, :dependent => :destroy
      has_many :tags,     :class_name => 'MyTags::Tag', :through => :taggings
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
my_tags-0.0.9 lib/my_tags/active_record.rb
my_tags-0.0.8 lib/my_tags/active_record.rb
my_tags-0.0.7 lib/my_tags/active_record.rb
my_tags-0.0.6 lib/my_tags/active_record.rb