rails_admin keep giving me undefined local variable or method `rails_admin' when access dashboard
Asked Answered
E

4

5

I've followed this:

https://github.com/sferik/rails_admin

And I think I've done everything needed, bundle install, rake db:migrate etc but I can't get rid of:

undefined local variable or method "rails_admin" for #<#<Class:0x0055e4c3e49c30>:0x0055e4c2e61db8>

enter image description here ` Any ideas?

Eschatology answered 23/4, 2018 at 18:34 Comment(4)
have you tried restarting your rails server?Kulsrud
yes, i've already done that.Eschatology
Please add ruby version and rails version to your question as wellSlippage
gem 'rails', '~> 5.1.5' , ruby 2.3.3p222 (2016-11-21) [x86_64-linux-gnu]Eschatology
M
2

have you tried to fix your route.rb

you can use this configuration :

devise_for :admins
mount RailsAdmin::Engine => '/admin', as: 'rails_admin'
Muskellunge answered 4/5, 2018 at 10:28 Comment(0)
I
2

Make sure you follow the setup instructions

rails g rails_admin:install

Also can you post the helper method code which is raising the error?

Try changing this in your haml file

#change
rails_admin.url 
#to 
rails_admin_url
Inotropic answered 28/4, 2018 at 12:10 Comment(0)
M
2

have you tried to fix your route.rb

you can use this configuration :

devise_for :admins
mount RailsAdmin::Engine => '/admin', as: 'rails_admin'
Muskellunge answered 4/5, 2018 at 10:28 Comment(0)
E
1

try using href as below. I think it should work if other things are proper.

href="#{main_app.url_for(action: action.action_name, controller: 'rails_admin/main', 
model_name: abstract_model.try(:to_param). id: (object.try(:persisted?) && object.try(:id) || nil))}"
Enormous answered 24/4, 2018 at 6:55 Comment(0)
E
1

You need to add the dashboard to the list of actions on your initializers/rails_admin.rb like this

RailsAdmin.config do |config|
  config.actions do
    dashboard
  end
end
Electrostatics answered 24/4, 2018 at 13:4 Comment(1)
i've configured that file : gist.github.com/ba01ac3b089887c841b92729554dcf30.gitEschatology

© 2022 - 2024 — McMap. All rights reserved.