Module: TagDb::ClassMacros
- Included in:
- ActiveRecord::Base
- Defined in:
- lib/tagutils/tags/active_record.rb
Instance Method Summary collapse
Instance Method Details
#has_many_tags(opts = {}) ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/tagutils/tags/active_record.rb', line 4 def ( opts={} ) puts " [TagDb.has_many_tags] adding taggings n tags has_many assocs to model >#{name}<" has_many :taggings, class_name: 'TagDb::Model::Tagging', :as => :taggable has_many :tags, class_name: 'TagDb::Model::Tag', :through => :taggings ### check: use tag_name instead of tag_key ??? scope :with_tag, ->(tag_key){ joins(:tags).where('tags.key' => tag_key) } end |