Administrate: uninitialized constant Administrate::Generators::InstallGenerator::DashboardManifest

Created on 22 Jan 2016  路  16Comments  路  Source: thoughtbot/administrate

Hi :smiley:

When I run the installer for Administrate, I get the following error:

rails generate administrate:install
Running via Spring preloader in process 33128
      create  app/controllers/admin/application_controller.rb
       route  namespace :admin do
    DashboardManifest::DASHBOARDS.each do |dashboard_resource|
      resources dashboard_resource
    end

    root controller: DashboardManifest::ROOT_DASHBOARD, action: :index
  end
      create  app/dashboards/dashboard_manifest.rb
/usr/local/lib/ruby/gems/2.3.0/gems/administrate-0.1.3/lib/generators/administrate/install/install_generator.rb:44:in `manifest': uninitialized constant Administrate::Generators::InstallGenerator::DashboardManifest (NameError)
    from /usr/local/lib/ruby/gems/2.3.0/gems/administrate-0.1.3/lib/generators/administrate/install/install_generator.rb:36:in `dashboard_resources'
    from /usr/local/lib/ruby/gems/2.3.0/gems/administrate-0.1.3/lib/generators/administrate/install/install_generator.rb:32:in `singular_dashboard_resources'
    from /usr/local/lib/ruby/gems/2.3.0/gems/administrate-0.1.3/lib/generators/administrate/install/install_generator.rb:24:in `run_dashboard_generators'
    from /usr/local/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
    from /usr/local/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
    from /usr/local/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `block in invoke_all'
    from /usr/local/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `each'
    from /usr/local/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `map'
    from /usr/local/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in `invoke_all'
    from /usr/local/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/group.rb:232:in `dispatch'
    from /usr/local/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
    from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.5/lib/rails/generators.rb:157:in `invoke'
    from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.5/lib/rails/commands/generate.rb:13:in `<top (required)>'
    from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:123:in `require_command!'
    from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:130:in `generate_or_destroy'
    from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:50:in `generate'
    from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
    from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.5/lib/rails/commands.rb:17:in `<top (required)>'
    from /Users/frabrunelle/administrate/bin/rails:9:in `<top (required)>'
    from /usr/local/Cellar/ruby/2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/local/Cellar/ruby/2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from -e:1:in `<main>'

Is anyone else getting this error? I get this error even on a totally new Rails application, so it should be pretty easy to reproduce.

Most helpful comment

I was also getting this error. i deleted the lines it added in my routes then ran spring stop and the generator again and this time it worked.

All 16 comments

I was getting this for hours :

麓麓麓
The Gemfile's dependencies are satisfied
/Users/EGN/Developer/Ruby/seguridad/config/routes.rb:3:in block (2 levels) in <top (required)>': uninitialized constant DashboardManifest (NameError) from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-4.2.5/lib/action_dispatch/routing/mapper.rb:882:inblock in namespace'
from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-4.2.5/lib/action_dispatch/routing/mapper.rb:817:in scope' from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-4.2.5/lib/action_dispatch/routing/mapper.rb:882:innamespace'
from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-4.2.5/lib/action_dispatch/routing/mapper.rb:1456:in namespace' from /Users/EGN/Developer/Ruby/seguridad/config/routes.rb:2:inblock in from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-4.2.5/lib/action_dispatch/routing/route_set.rb:434:in instance_exec' from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-4.2.5/lib/action_dispatch/routing/route_set.rb:434:ineval_block'
from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-4.2.5/lib/action_dispatch/routing/route_set.rb:412:in draw' from /Users/EGN/Developer/Ruby/seguridad/config/routes.rb:1:in from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/railties-4.2.5/lib/rails/application/routes_reloader.rb:40:in block in load_paths' from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/railties-4.2.5/lib/rails/application/routes_reloader.rb:40:ineach'
from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/railties-4.2.5/lib/rails/application/routes_reloader.rb:40:in load_paths' from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/railties-4.2.5/lib/rails/application/routes_reloader.rb:16:inreload!'
from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/railties-4.2.5/lib/rails/application/routes_reloader.rb:26:in block in updater' from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-4.2.5/lib/active_support/file_update_checker.rb:75:inexecute'
from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/railties-4.2.5/lib/rails/application/routes_reloader.rb:7:in execute' from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/railties-4.2.5/lib/rails/application/finisher.rb:81:inblock (2 levels) in module:Finisher'
from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-4.2.5/lib/active_support/callbacks.rb:446:in instance_exec' from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-4.2.5/lib/active_support/callbacks.rb:446:inblock in make_lambda'
from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-4.2.5/lib/active_support/callbacks.rb:192:in block in simple' from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-4.2.5/lib/active_support/callbacks.rb:504:inblock in call'
from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-4.2.5/lib/active_support/callbacks.rb:504:in each' from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-4.2.5/lib/active_support/callbacks.rb:504:incall'
from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-4.2.5/lib/active_support/callbacks.rb:92:in __run_callbacks__' from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-4.2.5/lib/active_support/callbacks.rb:778:in_run_prepare_callbacks'
from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activesupport-4.2.5/lib/active_support/callbacks.rb:81:in run_callbacks' from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-4.2.5/lib/action_dispatch/middleware/reloader.rb:83:inprepare!'
from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/actionpack-4.2.5/lib/action_dispatch/middleware/reloader.rb:55:in prepare!' from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/spring-1.6.2/lib/spring/application.rb:153:inserve'
from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/spring-1.6.2/lib/spring/application.rb:131:in block in run' from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/spring-1.6.2/lib/spring/application.rb:125:inloop'
from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/spring-1.6.2/lib/spring/application.rb:125:in run' from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/spring-1.6.2/lib/spring/application/boot.rb:18:in from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in require' from /usr/local/var/rbenv/versions/2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:inrequire'
from -e:1:in `

'
麓麓麓

But after installing for 10 times now its working, the reason? i don't know u.u

Hi, I'm having the same problem. Did you figure this out?
When I do: rails generate administrate:install

I get this error:
`block (2 levels) in

Reading some of the blogs about this, it seems that it might be related to spring gem or HABTM relationships which are defined incorrectly. I'm not sure if there is a suggested solution. Have you figured out how to fix this?

Thanks

Well when you "rails generate administrate:install" the routes appear in the config/routes.rb file, and those line generate the error. So, i "rails generate administrate:install" and then removed that lines from config/routes.rb file like 10 times, maybe is what you are saying (the spring gem) or something more complicated.

But don't you need the routes for the gem to work? It put these lines in my routes file:

namespace :admin do
DashboardManifest::DASHBOARDS.each do |dashboard_resource|
resources dashboard_resource
end

root controller: DashboardManifest::ROOT_DASHBOARD, action: :index

end

Are you saying the solution is to delete all of this?

Im saying that you should delete them and try to install administrate again(when you install it again the routes will appear again on the routes file), then test if it works. I did many times.

I was also getting this error. i deleted the lines it added in my routes then ran spring stop and the generator again and this time it worked.

thanks Quintin - that worked for me too

Yes that makes sense, spring always causing problems

DISABLE_SPRING=1 rails generate administrate:install works. thanks.

Works for me too! Thanks :smiley:

Worked for me too. Thank you.

I ran into this issue as well. Turns out I had my rails server running when I tried to run the install command. Removed the routes, shutdown the server, and ran it again without issue.

DISABLE_SPRING=1 rails generate administrate:install works fine.

@MincePie :+1: deleting the routes and reinstalling worked for me

I created issue #464 to discuss ways to get around the routes error.

@frabrunelle, @Xosmond, @MincePie, @QuintinAdam, @s2t2 and others, please join the discussion there!

Fixed by #464, which will go out in 0.2.0.

Was this page helpful?
0 / 5 - 0 ratings