前提・実現したいこと
rail_adminのリンクに飛ぼうとすると、以下のエラーメッセージが発生しました。
発生している問題・エラーメッセージ
NoMethodError (undefined method `new' for nil:NilClass): Extracted source (around line #160): 158 klass.setup if klass.respond_to? :setup 159 @authorize = proc do 160 @authorization_adapter = klass.new(*([self] + args).compact) 161 end 162 elsif block 163 @authorize = block
試したこと
https://www.gitmemory.com/issue/sferik/rails_admin/3187/528053850
https://www.rubydoc.info/gems/rails_admin/RailsAdmin/Config#DEFAULT_AUTHORIZE-constant
上記2記事を参考にしたところ、どうやらRail adminのオーソライゼーションを更新しないといけないですよという内容だったので、以下のようなコードに書き換えました。
該当のソースコード
Rails
1RailsAdmin.config do |config| 2 ### Popular gems integration 3 4 ## == Devise == 5 config.authenticate_with do 6 warden.authenticate! scope: :user 7 end 8 config.current_user_method(&:current_user) 9 10 config.authorize_with do 11 redirect_to main_app.root_path unless current_user.is_admin? 12 end 13 ## == Cancan == 14 config.authorize_with :cancancan 15 ## == Pundit == 16 config.authorize_with :pundit 17 18 19 ## == PaperTrail == 20 # config.audit_with :paper_trail, 'User', 'PaperTrail::Version' # PaperTrail >= 3.0.0 21 22 ### More at https://github.com/sferik/rails_admin/wiki/Base-configuration 23 24 ## == Gravatar integration == 25 ## To disable Gravatar integration in Navigation Bar set to false 26 # config.show_gravatar = true 27 28 config.actions do 29 dashboard # mandatory 30 index # mandatory 31 new 32 export 33 bulk_delete 34 show 35 edit 36 delete 37 show_in_app 38 39 ## With an audit adapter, you can add: 40 # history_index 41 # history_show 42 43 end 44end
しかし、同じエラーを吐かれてしまっております。
原因が分かる方がいらっしゃれば、ご教授いただければ幸いです。
よろしくお願いいたします。
回答1件
あなたの回答
tips
プレビュー