How to use multiple Active Admin instances for Complete Separate Models

感情迁移 提交于 2019-12-03 02:47:37

You can use namespaces for this.

ActiveAdmin.register Order, namespace: :supplier do
  # will be available at /supplier/orders
end

ActiveAdmin.register Order, namespace: :user do
  # available at /user/orders
end

You can customize the authentication for each namespace in config/initializers/active_admin.rb

For example:

  config.default_namespace = :user

  config.namespace :supplier do |supplier|
    supplier.authentication_method = :authenticate_supplier_user!
    supplier.current_user_method = :current_supplier_user
    supplier.logout_link_path = :destroy_supplier_user_session_path
    supplier.root_to = 'orders#index'
  end

  config.namespace :user do |user|
    user.authentication_method = false
    user.current_user_method = :current_user
    user.logout_link_path = false

More info on: http://activeadmin.info/docs/1-general-configuration.html#namespaces

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!