如何让rails-admin不重复模型名称?

时间:2016-05-26 15:26:15

标签: ruby-on-rails rails-admin

使用rails-admin,仪表板显示模型两次,请考虑以下屏幕截图:

image

RailsAdmin.config do |config|

  ## == Devise ==
  config.authenticate_with do
    warden.authenticate! scope: :user
  end
  config.current_user_method(&:current_user)

  ## == Cancan ==
  # config.authorize_with :cancan

  ## == Pundit ==
  # config.authorize_with :pundit

  ## == PaperTrail ==
  # config.audit_with :paper_trail, 'User', 'PaperTrail::Version' # PaperTrail >= 3.0.0

  ### More at https://github.com/sferik/rails_admin/wiki/Base-configuration

  config.actions do
    allowable_models = ['Lab', 'Order']

    dashboard do
      only allowable_models
    end

    index do
      only allowable_models
    end

    show do
      only allowable_models
    end

    new do
      only allowable_models
    end

    edit do
      only allowable_models
    end

    delete do
      only allowable_models
    end

    ## With an audit adapter, you can add:
    # history_index
    # history_show
  end
end

对象被显示两次并不重要,但据我了解这个宝石,对象不应该显示两次,我想修复它。关于在这里挖掘什么的想法?

谢谢!

1 个答案:

答案 0 :(得分:0)

我最近也有同样的问题。解决方案特别提到了 config / initializers / rails_admin.rb 中的模型名称:

config.included_models = ["FirstModel", "SecondModel", "ThirdModel"]