Class: Tag

Inherits:
Object
  • Object
show all
Includes:
DataMapper::Resource
Defined in:
lib/dm-is-taggable/is/tag.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.build(name) ⇒ Object



9
10
11
12
# File 'lib/dm-is-taggable/is/tag.rb', line 9

def self.build(name)
  name = name.strip
  Tag.first(:name => name) || Tag.create(:name => name)
end

Instance Method Details

#strip_nameObject



14
15
16
# File 'lib/dm-is-taggable/is/tag.rb', line 14

def strip_name
  self.name = self.name.strip if self.name
end