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



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

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



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

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

#countObject



24
25
26
# File 'lib/acts_as_taggable_on/tag.rb', line 24

def count
  read_attribute(:count).to_i
end

#to_sObject



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

def to_s
  name
end