Class: Tag

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/acts_as_taggable_on/tag.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.find_or_create_with_like_by_name(name) ⇒ Object

LIKE is used for cross-database case-insensitivity



8
9
10
# File 'lib/acts_as_taggable_on/tag.rb', line 8

def self.find_or_create_with_like_by_name(name)
  find(:first, :conditions => ["name LIKE ?", name]) || create(:name => name)
end

Instance Method Details

#==(object) ⇒ Object



12
13
14
# File 'lib/acts_as_taggable_on/tag.rb', line 12

def ==(object)
  super || (object.is_a?(Tag) && name == object.name)
end

#countObject



20
21
22
# File 'lib/acts_as_taggable_on/tag.rb', line 20

def count
  read_attribute(:count).to_i
end

#to_sObject



16
17
18
# File 'lib/acts_as_taggable_on/tag.rb', line 16

def to_s
  name
end