Can you please help me to understand your gem.
1. Do tags have to be in the model as a field?
2. How do I query the tags in the controller?
3. What about showing the tags in the view, how do I call them?
class Blog::Post
include Mongoid::Document
include Mongoid::TagCollectible::Tagged
before_validation :downcase_tags
validates_presence_of :body, :title, :summary
mount_uploader :post_pic, PostPicUploader
field :title, type: String
field :body, type: String
field :tags, type: String
field :date, type: DateTime
field :summary, type: String
field :post_type, type: String
field :author, type: String
private
def downcase_tags
tags.map(&:downcase) if tags
end
end
I'm unsure if my model is correct and don't see what to put in my controlle. Any help would be greatly appreciated. BTW I am using Mongoid 5.