Rails管理员以has_many嵌套形式隐藏按钮

时间:2016-02-12 18:26:26

标签: ruby-on-rails ruby has-many rails-admin belongs-to

我正在使用Rails Admin。我有三种模式:

class Tag < ActiveRecord::Base
    has_many :tags_users, :dependent => :destroy  
end

class TagsUser < ActiveRecord::Base
    belongs_to :user_spot, :inverse_of => :tags_users
    belongs_to :tag
end

class UserSpot < ActiveRecord::Base
    has_many :tags_users, :inverse_of => :user_spot
    accepts_nested_attributes_for :tags_users, :allow_destroy => true
end

以及显示的内容:

Image

我想隐藏按钮“添加新标记”和“编辑此标记”。我怎么能这样做?

1 个答案:

答案 0 :(得分:2)

尝试

@team = Team.find params[:team_id]