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