Module: SimpleTags::Taggable

Extended by:
ActiveSupport::Concern
Defined in:
lib/simple_tags/taggable.rb

Instance Method Summary collapse

Instance Method Details

#tag_listObject

Public: Return a comma-separated list of this model tags name



29
30
31
# File 'lib/simple_tags/taggable.rb', line 29

def tag_list
  tags.map(&:name).join(", ")
end

#tag_list=(names) ⇒ Object

Public: Sets the model tags ‘names` must be a list of tag names, separated by commas



36
37
38
39
40
# File 'lib/simple_tags/taggable.rb', line 36

def tag_list=(names)
  self.tags = names.split(",").map do |n|
    SimpleTags::Tag.where(name: n.strip).first_or_create!
  end
end