rails-admin

'current_user' undefined in rails_admin with clearance

╄→гoц情女王★ 提交于 2021-02-07 14:23:13
问题 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).

'current_user' undefined in rails_admin with clearance

泪湿孤枕 提交于 2021-02-07 14:22:17
问题 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).

authorization rails_admin with pundit

偶尔善良 提交于 2021-02-07 08:27:46
问题 I use pundit gem to authorization. In my file config/initializers/rails_admin.rb RailsAdmin.config do |config| config.authorize_with :pundit config.current_user_method(&:current_user) ...... end I follow the instructions in https://github.com/sudosu/rails_admin_pundit But in when run code, error : protected method `policy' called for #<Rails_Admin::MainController I use rails_admin 0.8.1 Please guide me use pundit in rails_admin ( tutorial, examle, ...) 回答1: You can try to use this gem or just

authorization rails_admin with pundit

放肆的年华 提交于 2021-02-07 08:25:17
问题 I use pundit gem to authorization. In my file config/initializers/rails_admin.rb RailsAdmin.config do |config| config.authorize_with :pundit config.current_user_method(&:current_user) ...... end I follow the instructions in https://github.com/sudosu/rails_admin_pundit But in when run code, error : protected method `policy' called for #<Rails_Admin::MainController I use rails_admin 0.8.1 Please guide me use pundit in rails_admin ( tutorial, examle, ...) 回答1: You can try to use this gem or just

authorization rails_admin with pundit

自作多情 提交于 2021-02-07 08:24:35
问题 I use pundit gem to authorization. In my file config/initializers/rails_admin.rb RailsAdmin.config do |config| config.authorize_with :pundit config.current_user_method(&:current_user) ...... end I follow the instructions in https://github.com/sudosu/rails_admin_pundit But in when run code, error : protected method `policy' called for #<Rails_Admin::MainController I use rails_admin 0.8.1 Please guide me use pundit in rails_admin ( tutorial, examle, ...) 回答1: You can try to use this gem or just

authorization rails_admin with pundit

感情迁移 提交于 2021-02-07 08:24:32
问题 I use pundit gem to authorization. In my file config/initializers/rails_admin.rb RailsAdmin.config do |config| config.authorize_with :pundit config.current_user_method(&:current_user) ...... end I follow the instructions in https://github.com/sudosu/rails_admin_pundit But in when run code, error : protected method `policy' called for #<Rails_Admin::MainController I use rails_admin 0.8.1 Please guide me use pundit in rails_admin ( tutorial, examle, ...) 回答1: You can try to use this gem or just

rails_admin with cancan not catching access denied exception for redirect

落花浮王杯 提交于 2020-08-27 07:07:10
问题 I am using rails 5, rails_admin, devise and cancancan. Everything works correctly, but when there is access denied, it shows a 'You are not authorized to access this page' error screen. I want to redirect to root_path, I've been searching and I only found that I have to write in app/controllers/application_controller.rb this code: class ApplicationController < ActionController::Base rescue_from CanCan::AccessDenied do |exception| redirect_to root_path, :alert => exception.message end end And

rails_admin with cancan not catching access denied exception for redirect

假装没事ソ 提交于 2020-08-27 07:07:05
问题 I am using rails 5, rails_admin, devise and cancancan. Everything works correctly, but when there is access denied, it shows a 'You are not authorized to access this page' error screen. I want to redirect to root_path, I've been searching and I only found that I have to write in app/controllers/application_controller.rb this code: class ApplicationController < ActionController::Base rescue_from CanCan::AccessDenied do |exception| redirect_to root_path, :alert => exception.message end end And

Rails: Wrong number of arguments (given 2, expected 1) MongoID

我们两清 提交于 2020-03-23 12:02:02
问题 I'm trying to open my MongoDB models, however, I'm getting the following error: MONGODB | xxx.xx.x.xxx:27017 | db.find | FAILED | wrong number of arguments (given 2, expected 1) | 0.013306s My Mongo credentials are correct, and I can connect to the database's collections outside of Rails. The first few lines of the error are: Started GET "/admin/xsl_sheet" for xxx.xxx.xxx.xxx at 2020-03-03 13:49:54 UTC Processing by RailsAdmin::MainController#index as HTML Parameters: {"model_name"=>"xsl