I've been using rails_admin v0.7.0 with the clearance gem successfully up this point. I tried to update rails_admin to v1.0 today, but am getting an undefined variable or method error for current_user. In v0.7.0 it appears that RailsAdmin::MainController inherits from ApplicationController, whereas in v1.0 it inherits directly from ActionController::Base, which would explain current_user is now undefined (I believe current_user is defined in ApplicationController with the clearance gem). However, since I'm not finding anyone else with this problem, I'm thinking I must be missing something.
I wasn't the one who set up clearance on this app, but I don't think we're doing anything non-standard with it that would affect this. Clearance::Controller is included in ApplicationController. No special definition of current_user.
config/initializers/rails_admin.rb
RailsAdmin.config do |config|
# Popular gems integration
## Clearance
config.authorize_with do |controller|
unless current_user.admin?
redirect_to(
main_app.root_path,
alert: "You are not permitted to view this page"
)
end
end
config.current_user_method { current_user }
end