Class: SprayPaint::Tag

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/spray_paint/tag.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.find_or_create_by_name(name) ⇒ Object



11
12
13
14
15
16
17
# File 'app/models/spray_paint/tag.rb', line 11

def self.find_or_create_by_name(name)
  if match = where(:name => name.downcase).first
    return match
  else
    create! :name => name
  end
end

Instance Method Details

#to_lower_caseObject



7
8
9
# File 'app/models/spray_paint/tag.rb', line 7

def to_lower_case
  self.name = name.downcase
end