【发布时间】:2015-06-30 23:08:45
【问题描述】:
我希望能够使用“添加过滤器”下拉菜单,以便管理员可以搜索被标记为特定名称的帖子。
我的帖子模型
class Post < ActiveRecord::Base
belongs_to :user
has_many :post_flags
has_many :flags, through: :post_flags
config/initializers/rails_admin.rb
config.model 'Post' do
exclude_fields :rank, :embedded_url, :attached_picture, :updated_at
object_label do
"#{bindings[:post].user.name}"
end
list do
field :text_content
field :created_at
field :user_id
field :likes_number
field :post_flags
end
end
我尝试在 :post_flags 字段中添加“可搜索”,但无济于事。任何帮助将非常感激。
【问题讨论】:
标签: ruby-on-rails ruby associations rails-admin