Sha256: b8a1459d74ab9bc9f5f1a45008479d8af13ba21d33d9fd04dbdfabe6ac05b893

Contents?: true

Size: 479 Bytes

Versions: 1

Compression:

Stored size: 479 Bytes

Contents

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

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

Version data entries

1 entries across 1 versions & 1 rubygems

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