Sha256: 4283bb7e754a199ebfedeaf3972fd0cf5eba65b223dc0d478d7031a2dca465e2

Contents?: true

Size: 467 Bytes

Versions: 1

Compression:

Stored size: 467 Bytes

Contents

module TagPanda::ActiveRecord
  def self.included(base)
    # include our class methods
    base.extend TagPanda::ActiveRecord::ClassMethods
  end

  module ClassMethods
    # Set up the underlying tag associations in the model
    def has_many_tags
      has_many :taggings, :class_name => 'TagPanda::Tagging',
        :as => :taggable, :dependent => :destroy
      has_many :tags,     :class_name => 'TagPanda::Tag',
        :through => :taggings
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tag_panda-0.0.2 lib/tag_panda/active_record.rb