Muhammad Rahmatullah
Muhammad Rahmatullah

Reputation: 326

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

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?

Upvotes: 5

Views: 1204

Answers (4)

Radiet Billahirabba
Radiet Billahirabba

Reputation: 86

have you tried to fix your route.rb

you can use this configuration :

devise_for :admins
mount RailsAdmin::Engine => '/admin', as: 'rails_admin'

Upvotes: 2

lacostenycoder
lacostenycoder

Reputation: 11216

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

Upvotes: 2

Guillermo Siliceo Trueba
Guillermo Siliceo Trueba

Reputation: 4609

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

Upvotes: 1

Dyaniyal Wilson
Dyaniyal Wilson

Reputation: 1060

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

Upvotes: 1

Related Questions