Module: SimpleTaggable

Extended by:
ActiveSupport::Concern
Defined in:
lib/simple_taggable.rb,
lib/simple_taggable/version.rb,
lib/simple_taggable/tag_list.rb,
lib/simple_taggable/models/tag.rb,
lib/simple_taggable/models/tagging.rb

Defined Under Namespace

Modules: ClassMethods, Models Classes: InstallGenerator, TagList

Constant Summary collapse

VERSION =
"1.0.1"

Instance Method Summary collapse

Instance Method Details

#tag_listObject



74
75
76
77
78
79
80
# File 'lib/simple_taggable.rb', line 74

def tag_list
  @tag_list ||= SimpleTaggable::TagList.new(
    tags.pluck(:name),
    filters: self.class.__tag_filters__,
    converters: self.class.__tag_converters__,
  )
end

#tag_list=(tag_list) ⇒ Object



82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/simple_taggable.rb', line 82

def tag_list=(tag_list)
  case tag_list
  when TagList, Array, String
    @tag_list = SimpleTaggable::TagList.new(
      tag_list,
      filters: self.class.__tag_filters__,
      converters: self.class.__tag_converters__,
    )
  else
    raise TypeError.new("tag_list is not TagList object")
  end
end