Taxonomies
sh
rails g trek:taxonomiesSets up a tagging & categorization system:
- the
Tag,TagCategoryandTaggingmodels with their migrations - the admin panel to manage tags and categories
Once installed, make any model taggable with the Trek::Taggable concern:
ruby
class Article < ApplicationRecord
include Trek::Taggable
end
article.tags << Tag.find_or_create_by(name: "Ruby")
article.tag_names # => ["Ruby"]