rails_admin: NameError in RailsAdmin::Main#dashboard

Hi,all. I use this rails_admin and I’m getting this error in case of show the dashboard.

I use the standard view interface of this gem, I don’t create any kind of custom view&controller in my application. I have tried this gem:rails_admin over three months, I don’t have any kind of trouble at all.

I tried rails: 4.0.1/4.0.2 and rails_admin: 0.6.0/0.6.1, but I got same error. And I tried to solve the cause of this error, but I give up because it is too difficult for me. Please help me!

Showing /var/myappl/vendor/src/gems/rails_admin/app/views/layouts/rails_admin/application.html.haml where line #17 raised:

undefined local variable or method `dashboard_path' for #<#<Class:0x007fe921093cd0>:0x007fe9242f2e88>

14  .navbar.navbar-fixed-top
15    .navbar-inner
16      .container-fluid
17        %a.brand.pjax{:href => dashboard_path}
18          = _get_plugin_name[0] || 'Rails'
19          %small= _get_plugin_name[1] || 'Admin'
20        .nav-collapse

my environments as follow:

config/routes.rb:

MyAppl::Application.routes.draw do
  mount RailsAdmin::Engine=>'/system/monitors/admin/index', as: 'rails_admin'
    ...
  root to: 'appl/pages#index'
end

basic environments:

Ruby version    2.1.0 (x86_64-linux)
RubyGems version    2.2.0
Rack version    1.5
Rails version   4.0.2
JavaScript Runtime  Node.js (V8)
Action Pack version 4.0.2
Action Mailer version   4.0.2
Active Support version  4.0.2
Middleware  

    Rack::Sendfile
    ActionDispatch::Static
    Rack::Lock
    Dragonfly::CookieMonster
    Rack::Runtime
    Rack::MethodOverride
    ActionDispatch::RequestId
    Rails::Rack::Logger
    ActionDispatch::ShowExceptions
    ActionDispatch::DebugExceptions
    ActionDispatch::RemoteIp
    ActionDispatch::Reloader
    ActionDispatch::Callbacks
    ActionDispatch::Cookies
    ActionDispatch::Session::CookieStore
    ActionDispatch::Flash
    ActionDispatch::ParamsParser
    Remotipart::Middleware
    Rack::Head
    Rack::ConditionalGet
    Rack::ETag
    TreasureData::Logger::Agent::Rack::Hook
    Rack::Mongoid::Middleware::IdentityMap
    HttpAcceptLanguage::Middleware
    Dragonfly::Middleware
    Rack::Pjax

Application root    /var/myappl
Environment development

Gemfile file:

source 'https://rubygems.org'

gem 'rails', '4.0.2'
group :doc do
  gem 'sdoc', require: false
end
gem 'debugger', group: [:development, :test]
group :development, :test do
  gem 'rspec-rails'
  gem 'capybara'
  gem 'launchy'
  gem 'yard', require: false
  gem 'spring'
  gem "spring-commands-rspec"
end
gem 'unicorn'
gem "mongoid_rails4", "~> 4.0.0"
gem "mongo", "~> 1.9.2"
gem 'bson', "~> 1.9.2"
gem "bson_ext", "~> 1.9.2"
gem 'protected_attributes'
gem 'fluentd'
gem 'td-logger'
gem "sunspot_rails", "~>2.0.0.pre.120925"
group :development do
  gem "sunspot_solr", "~>2.0.0.pre.120925"
end
gem 'sunspot_mongoid', path: 'vendor/src/gems/sunspot_mongoid'
gem 'rack-cache', require: 'rack/cache'
gem 'dragonfly'
gem 'dragonfly-mongo_data_store'
gem "redis"
gem 'sidekiq'
gem 'sidetiq'
gem 'sinatra', require: nil
gem 'slim'
gem 'systemu'
gem 'mimemagic'
gem 'jbuilder'
gem 'nokogiri'
gem 'sanitize'
gem 'rails_admin', "0.6.1"
gem 'oauth', "~> 0.4.4"
gem 'oauth2', "~> 0.8.0"
gem 'bcrypt-ruby', "~> 3.0.0"
gem 'state_machine'
gem 'monetize'
gem 'money-rails'
gem 'wunderground'
gem 'rails-i18n'
gem 'http_accept_language'
gem 'activemerchant'
gem 'sass-rails'
gem 'uglifier'
gem 'coffee-rails'
gem 'haml'
gem 'kaminari'
gem 'jquery-rails'
gem 'jquery-ui-rails'
gem 'bootstrap-sass'
gem 'bootstrap-datepicker-rails'

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Comments: 17 (6 by maintainers)

Most upvoted comments

Also seeing this one. “rake routes” output is good and shows the same rails_admin routes as in @hmaruchi’s case, but line 8 in views/layouts/rails_admin/_navigation.html.haml throws a

undefined local variable or method 'dashboard_path' for #<#<Class:0x007fa70fef6e98>:0x007fa711570480>

Everything seems to be in check. Have you tried mounting it into /admin path? it’s worth a try.

What does app.rails_admin.dashboard_path return in rails console?