Thursday, May 3, 2018

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

Leave a Comment

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?

3 Answers

Answers 1

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 

Answers 2

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))}" 

Answers 3

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 
If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment