LoginSignup
1
1

More than 5 years have passed since last update.

mongoid で acts-as-taggable-on

Posted at

mongoid_taggable という plugin がある。

インストール

Gemfileに

gem 'mongoid_taggable'

使い方

model/post.rb
class Post
  include Mongoid::Document
  include Mongoid::Taggable

  field :title
  field :content
end

これだけ。
post.rb に配列で embed される模様。

view/post/show.html.erb
<%= @post.tags %>
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1