Sha256: 13745077103978776a9c2c7e3bdd8a26ed8a9bb8782f524590eacf6fc258373f
Contents?: true
Size: 567 Bytes
Versions: 1
Compression:
Stored size: 567 Bytes
Contents
module MyTags::ActiveRecord def self.included(base) base.extend MyTags::ActiveRecord::ClassMethods end def tags @tags ||= MyTags::Tags.new self end def tags=(names) if names.is_a?(MyTags::Tags) @tag_names = names else @tag_names = MyTags::Tags.new_with_names self, names end 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
my_tags-0.0.3 | lib/my_tags/active_record.rb |