Sha256: 33b936bc93b2dc90291ff09da59d938ef3f68ce18f42adeee76bbfbf31dc4965

Contents?: true

Size: 749 Bytes

Versions: 2

Compression:

Stored size: 749 Bytes

Contents

class Tagging < ActiveRecord::Base #:nodoc:
  belongs_to :tag
  belongs_to :taggable, :polymorphic => true
  belongs_to :tagger, :polymorphic => true
  validates_presence_of :context
  
  named_scope :with_context, lambda {|context|
    {:conditions => ["#{quoted_table_name}.context = ?", context]}
  }
  named_scope :except_context, lambda {|context|
    {:conditions => ["#{quoted_table_name}.context <> ?", context]}
  }
  
  # Be careful with these -- they sanitize nothing.
  # Pass them actual tags or tag ids.
  named_scope :only_tags, lambda {|tags|
    {:conditions => ["#{quoted_table_name}.tag_id IN (?)", tags]}
  }
  named_scope :except_tags, lambda {|tags|
    {:conditions => ["#{quoted_table_name}.tag_id NOT IN (?)", tags]}
  }
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
masover-acts-as-taggable-on-1.0.2.7 lib/acts_as_taggable_on/tagging.rb
masover-acts-as-taggable-on-1.0.2.8 lib/acts_as_taggable_on/tagging.rb