Loading an ability class located in app/models/abilities directory, it causes an error.
Reproduction steps
When I follow the description of this wiki page and configure RailsAdmin like below:
# MyAbility class is located in app/models/abilities/my_ability.rb
config.authorize_with :cancancan, Abilities::MyAbility
the following error occurs:
The constant Abilities is not loaded yet upon the execution of the RailsAdmin initializer.
We don't recommend to do this and may lead to issues, but if you really have to do so you can explicitly require it by adding:
require 'abilities'
on top of config/initializers/rails_admin.rb.
Expected behavior
We should be able to specify the custom ability class located in abilities directory.
Describe the bug
https://github.com/railsadminteam/rails_admin/wiki/CanCanCan#use-different-ability-classes-for-front-end-and-admin
Loading an ability class located in
app/models/abilities
directory, it causes an error.Reproduction steps
When I follow the description of this wiki page and configure RailsAdmin like below:
the following error occurs:
Expected behavior
We should be able to specify the custom ability class located in
abilities
directory.Suggestion
I'd like to suggest the following way:
so that we can later classify the given string.
Additional context
rails
version: Rails 6.1.6.1rails_admin
version: 3.1.0rails_admin
npm package version: NoneAdd any other context about the problem here.