I am currently doing a project and the gems that I've used are: devise, rails admin and cancancan.. The codes below will add the CRUD and also a default views/page
Ability.rb
class Ability
include CanCan::Ability
def initialize(user)
alias_action :create, :read, :update, :destroy, to: :crud
if user.role == 'admin'
can :read, [xxxx]
can :crud, [xxxx]
can :access, :rails_admin
can :dashboard
end
end
end
Question: Where can I find the view or page? So that I can edit the view/s
The Ability
class is where all user permissions are defined, it does not add default views. devise
comes with default views packaged within the gem. In order to customize those views, you would have to run the following command:
rails generate devise:views
This command copies all devise views to your application under your_app/app/views/devise
folder. You should be able to customize specific views from there. Also, link to configure devise views for your reference.
UPDATE
Rails_admin
documentation suggests that they are strongly encouraging making edits to the dashboard views via the DSL. A few examples for your reference: #1, #2.
rails_admin
views reside packaged in the gem here. If you absolutely need to add a lot of customizations that cannot be done using DSL then add similar view structure to your app. For eg: to customize dashboard view, create your_app/app/views/rails_admin/main/dashboard.html.erb
and write your own dashboard view.