Sha256: e1c310ca146a1fa1a321d14459ccd0a3ac75f584c29a5e8ecc967610bb7e7193
Contents?: true
Size: 498 Bytes
Versions: 1
Compression:
Stored size: 498 Bytes
Contents
class Tag < ActiveRecord::Base has_many :taggings validates_presence_of :name validates_uniqueness_of :name # LIKE is used for cross-database case-insensitivity def self.find_or_create_with_like_by_name(name) name.downcase! find(:first, :conditions => ["name LIKE ?", name]) || create(:name => name) end def ==(object) super || (object.is_a?(Tag) && name == object.name) end def to_s name end def count read_attribute(:count).to_i end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
masover-acts-as-taggable-on-1.0.2.8 | lib/acts_as_taggable_on/tag.rb |