Class: Tag
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Tag
- Defined in:
- lib/tag.rb
Class Method Summary collapse
-
.find_or_create_with_like_by_name(name) ⇒ Object
LIKE is used for cross-database case-insensitivity.
Instance Method Summary collapse
Class Method Details
.find_or_create_with_like_by_name(name) ⇒ Object
LIKE is used for cross-database case-insensitivity
11 12 13 |
# File 'lib/tag.rb', line 11 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
15 16 17 |
# File 'lib/tag.rb', line 15 def ==(object) super || (object.is_a?(Tag) && name == object.name) end |
#count ⇒ Object
23 24 25 |
# File 'lib/tag.rb', line 23 def count read_attribute(:count).to_i end |
#to_s ⇒ Object
19 20 21 |
# File 'lib/tag.rb', line 19 def to_s name end |