Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uninitialized constant Dashboard #2528

Closed
redrick opened this issue Oct 3, 2013 · 13 comments
Closed

uninitialized constant Dashboard #2528

redrick opened this issue Oct 3, 2013 · 13 comments

Comments

@redrick
Copy link

redrick commented Oct 3, 2013

Hi guys,

I am trying activeadmin for the first time and I got as far as rake db:migrate after generating and I got this error, which I cannot google properly, so I am writing here:

rake db:migrate --trace                                                                                                                                                       10:38:39  ☁  devel ☂ ⚡ ✭
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
undefined method `layout' for ActiveAdmin::Devise::SessionsController:Class
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/bundler/gems/active_admin-8fa7914d8e70/lib/active_admin/devise.rb:32:in `block in <module:Controller>'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/gems/activesupport-4.0.0/lib/active_support/concern.rb:114:in `class_eval'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/gems/activesupport-4.0.0/lib/active_support/concern.rb:114:in `append_features'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/bundler/gems/active_admin-8fa7914d8e70/lib/active_admin/devise.rb:58:in `include'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/bundler/gems/active_admin-8fa7914d8e70/lib/active_admin/devise.rb:58:in `<class:SessionsController>'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/bundler/gems/active_admin-8fa7914d8e70/lib/active_admin/devise.rb:57:in `<module:Devise>'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/bundler/gems/active_admin-8fa7914d8e70/lib/active_admin/devise.rb:4:in `<module:ActiveAdmin>'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/bundler/gems/active_admin-8fa7914d8e70/lib/active_admin/devise.rb:3:in `<top (required)>'
/Users/Redrick/Projects/intranet_server/config/routes.rb:8:in `block in <top (required)>'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/gems/actionpack-4.0.0/lib/action_dispatch/routing/route_set.rb:316:in `instance_exec'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/gems/actionpack-4.0.0/lib/action_dispatch/routing/route_set.rb:316:in `eval_block'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/gems/actionpack-4.0.0/lib/action_dispatch/routing/route_set.rb:294:in `draw'
/Users/Redrick/Projects/intranet_server/config/routes.rb:4:in `<top (required)>'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `load'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `block in load'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222:in `load'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:40:in `each'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:40:in `load_paths'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:16:in `reload!'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/gems/railties-4.0.0/lib/rails/application.rb:102:in `reload_routes!'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/bundler/gems/active_admin-8fa7914d8e70/lib/active_admin/application.rb:248:in `block in attach_reloader'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/gems/activesupport-4.0.0/lib/active_support/callbacks.rb:387:in `_run__4436635092718176482__prepare__callbacks'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/gems/activesupport-4.0.0/lib/active_support/callbacks.rb:80:in `run_callbacks'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/gems/actionpack-4.0.0/lib/action_dispatch/middleware/reloader.rb:74:in `prepare!'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/gems/actionpack-4.0.0/lib/action_dispatch/middleware/reloader.rb:46:in `prepare!'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/gems/railties-4.0.0/lib/rails/application/finisher.rb:50:in `block in <module:Finisher>'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `instance_exec'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `run'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/gems/railties-4.0.0/lib/rails/initializable.rb:55:in `block in run_initializers'
/Users/Redrick/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:150:in `block in tsort_each'
/Users/Redrick/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:183:in `block (2 levels) in each_strongly_connected_component'
/Users/Redrick/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:219:in `each_strongly_connected_component_from'
/Users/Redrick/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:182:in `block in each_strongly_connected_component'
/Users/Redrick/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:180:in `each'
/Users/Redrick/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:180:in `each_strongly_connected_component'
/Users/Redrick/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tsort.rb:148:in `tsort_each'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/gems/railties-4.0.0/lib/rails/initializable.rb:54:in `run_initializers'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/gems/railties-4.0.0/lib/rails/application.rb:215:in `initialize!'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/gems/railties-4.0.0/lib/rails/railtie/configurable.rb:30:in `method_missing'
/Users/Redrick/Projects/intranet_server/config/environment.rb:5:in `<top (required)>'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `block in require'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/gems/railties-4.0.0/lib/rails/application.rb:189:in `require_environment!'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/gems/railties-4.0.0/lib/rails/application.rb:249:in `block in run_tasks_blocks'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/gems/rake-10.1.0/lib/rake/task.rb:236:in `call'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/gems/rake-10.1.0/lib/rake/task.rb:236:in `block in execute'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/gems/rake-10.1.0/lib/rake/task.rb:231:in `each'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/gems/rake-10.1.0/lib/rake/task.rb:231:in `execute'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/gems/rake-10.1.0/lib/rake/task.rb:175:in `block in invoke_with_call_chain'
/Users/Redrick/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/gems/rake-10.1.0/lib/rake/task.rb:168:in `invoke_with_call_chain'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/gems/rake-10.1.0/lib/rake/task.rb:197:in `block in invoke_prerequisites'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/gems/rake-10.1.0/lib/rake/task.rb:195:in `each'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/gems/rake-10.1.0/lib/rake/task.rb:195:in `invoke_prerequisites'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/gems/rake-10.1.0/lib/rake/task.rb:174:in `block in invoke_with_call_chain'
/Users/Redrick/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/gems/rake-10.1.0/lib/rake/task.rb:168:in `invoke_with_call_chain'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/gems/rake-10.1.0/lib/rake/task.rb:161:in `invoke'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/gems/rake-10.1.0/lib/rake/application.rb:149:in `invoke_task'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/gems/rake-10.1.0/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/gems/rake-10.1.0/lib/rake/application.rb:106:in `each'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/gems/rake-10.1.0/lib/rake/application.rb:106:in `block in top_level'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/gems/rake-10.1.0/lib/rake/application.rb:115:in `run_with_threads'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/gems/rake-10.1.0/lib/rake/application.rb:100:in `top_level'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/gems/rake-10.1.0/lib/rake/application.rb:78:in `block in run'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/gems/rake-10.1.0/lib/rake/application.rb:165:in `standard_exception_handling'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/gems/rake-10.1.0/lib/rake/application.rb:75:in `run'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/gems/rake-10.1.0/bin/rake:33:in `<top (required)>'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/bin/rake:23:in `load'
/Users/Redrick/.rvm/gems/ruby-2.0.0-p247@intranet_server/bin/rake:23:in `<main>'
Tasks: TOP => db:migrate => environment

I am trying this on ruby 2.0.0p247 with rails 4.0.0
using rails-api, it is a REST API, where I need something like this admin to manage content apart from client...

note : as I looked closely on rails g from install instructions it threw me this at the end:

    generate  active_admin:assets
/Users/Redrick/.rvm/rubies/ruby-2.0.0-p247/bin/ruby: No such file or directory -- bin/rails (LoadError)

even it is a REST API I added views directory, where only layouts folder is present with application.html.erb
I am using cancan for auth (but I read somewhere thats no problem...)

I will supply all additional info you need, applying this gem would be a big big help for me, thx in advance

UPDATE:

ok I got it working by adding missing actionpack library into application_controller.rb

include AbstractController::Layouts

but still cannot get rid of the loaderror at the beggining:

No such file or directory -- bin/rails (LoadError)

and also now I got myselft error when loading page localhost:3000/admin:

NameError in Admin::DashboardController#index

uninitialized constant Dashboard

and I am still stuck....

@zorab47
Copy link
Contributor

zorab47 commented Oct 3, 2013

Your issue with bin/rails is likely related to rvm, but I am not very familiar with it.

@redrick
Copy link
Author

redrick commented Oct 3, 2013

I tryed now with new rails-api app and after some arm twisting it works, but when the same applied on this app, which is quiet bigger, nothing works..

what is weird thou is that with the other app I do not get the bin/rails issue and also that here I still got the same uninitialized Dashboard constant error, nothing ever changes :(

I have no clue what next, I dont even know what to inspect, because I mirrored the changes from working app into this one and nothing...

@zorab47
Copy link
Contributor

zorab47 commented Oct 3, 2013

How is your ActiveAdmin dashboard defined?

It should be define as a page like the current dashboard.rb template. ActiveAdmin no longer defines a Dashboard constant.

@redrick
Copy link
Author

redrick commented Oct 3, 2013

it is exactly like you wrote.... i dont get it....

now i am stuck here, I dont know where to look now...
I am going to give it a chance in the morning...

please say if you got some pointers I got to double check, thx :)

@seanlinsley
Copy link
Contributor

Perhaps this is related to #2464. Via @dstosik

If, before installing AA, there is already one (or many) line containing devise_for in config/routes.rb, then the code ActiveAdmin.routes(self) will be added as many times, plus one.

@redrick
Copy link
Author

redrick commented Oct 4, 2013

Ok guys, now I know that it is a cancan's fault, I seemed to not fully comment it out before, but now I did and I can see something from AA, still I got no clue how to solve the thing with cancan...

You see, the problem now is, that if I try other routes (with cancan ON) it gives me that CommentsAbility undefined, which is OK, I just define what it asks me for and thats it, but with the dashboard its different...

Anyone tryed it in this setup?

Sry I did not mention cancan, I was sure that its not the problem, but as it seems I was wrong...

and still I got no stylesheets or js, because of the mistake with bin/rails :(

thx in advance for any ideas :)

UPDATE:
ok with cancan commented out, i got issue with empty chain as I proposed pull request

but then when I am sure that cancan is configured according to docs
I got the uninitialized constant for every model there, now its:

NameError in Admin::CommentsController#index
uninitialized constant Comment

@afast
Copy link

afast commented Oct 4, 2013

@redrick Your problem with the dashboard is because it was removed on 0.6.1. But it's working on 0.6.0.
Make sure your Gemfile is locked to 0.6.0 to get the dashboard functionality.

@seanlinsley
Copy link
Contributor

@afast I don't know what you mean. 0.6.0 and 0.6.1 both use the same dashboard implementation. I think you're talking about 0.5.x

@afast
Copy link

afast commented Oct 4, 2013

@daxter Oh sorry, my bad, I got this one wrong. I was referring to the admin/dashboard.rb that was deprecated.
The discussion here is not related to that.

Sorry again, should I delete my comment to avoid further confusion?

@seanlinsley
Copy link
Contributor

I think it's better to continue discussion in the ticket you created, #2538

@redrick
Copy link
Author

redrick commented Oct 7, 2013

ok now I am in dead end, I just know that commenting out load_and_authorize_resource (which is cancans way of authorizing stuff) everything works like a charm, but when i put it back, I still got the ugly error as described many time up here:

NameError in Admin::DashboardController#index
uninitialized constant Dashboard

anybody got similar problems with cancan and active admin ? I read one from 2 years before here but that was no help for me....

also i found this where I found out, that when loading dashboards it seems to ignore my ability class and just throws the error...

please dont you have some experience with things like this ? I would appreciate those very much, thx guy for your time :)

@seanlinsley
Copy link
Contributor

Can you reproduce this in a clean test Rails app, and upload it to GitHub?

@redrick
Copy link
Author

redrick commented Oct 7, 2013

I was trying that once today, clean app does not do these things and as I just got this app from colleague who left, this is going to be his fault by faultly implementing cancan functionality, for now, after few nice hours of trying, I am going to start from scratch and if I am able to reproduce it then I will reopen this, thx for patiance, sry for bothering :(

@redrick redrick closed this as completed Oct 7, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants