Sha256: c69326d6b25f7ed11e100ea82e589de6fa9d667eb543164c326f936210c11461
Contents?: true
Size: 557 Bytes
Versions: 3
Compression:
Stored size: 557 Bytes
Contents
class Tag < ActiveRecord::Base class << self def find_or_initialize_with_name_like_and_kind(name, kind) with_name_like_and_kind(name, kind).first || new(:name => name, :kind => kind) end end has_many :taggings, :dependent => :destroy validates_presence_of :name validates_uniqueness_of :name, :scope => :kind named_scope :with_name_like_and_kind, lambda { |name, kind| { :conditions => ["name like ? AND kind = ?", name, kind] } } named_scope :of_kind, lambda { |kind| { :conditions => {:kind => kind} } } end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
bdimcheff-is_taggable-0.1.0 | lib/tag.rb |
bdimcheff-is_taggable-0.1.1 | lib/is_taggable/tag.rb |
is_taggable-0.1.0 | lib/tag.rb |