简体   繁体   中英

How to create two admin view and separating the model between 2 admin views by using rails_admin gem

I want to create two admin views by using rails_admin gem. I created one admin and i specify the path( mount RailsAdmin::Engine => '/admin', :as => 'rails_admin' in routes.rb) .

Similarly I specified another path (mount RailsAdmin::Engine => '/superadmin', :as => 'superadmin' ) .

Now I am getting the same views for both superadmin and admin view. I used devise and cancan for authentication.

But I want to seperate the model in 2 views. I don't know where to make changes.
In config/initializers/rails_admin.rb I included some models but it is reflected in both admin views.

How to accomplish this?

You cant achieve that using rails_admin . I've tried couple of months ago and found its not made for that.

Currently I am using rails_admin for SuperAdmin as its required less customization.

And

I am using active_admin for normal administration.

Rails admin lets you customize stuff by user but you'll have to do a tedious configuration for all your models. If you want super fine grained customization. For example

edit do
  field :avatar do
    visible do
      bindings[:view]._current_user.id
    end
  end
end

You can always use cancancan and customize your can read permissions depending on the type of user, rails_admin will honor them.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM