Sha256: fd0dda35b0bd210713380f5cfc96a30e2d90c28b04309e49eab7d7ae00e304ba

Contents?: true

Size: 487 Bytes

Versions: 1

Compression:

Stored size: 487 Bytes

Contents

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

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tag_ramaprasad-1.0.1 lib/tag_ramaprasad/active_record.rb