Open furqan85 opened 10 years ago
What version of rails, ruby, and any gems you can share the versions of? Was this on the first page load or did it appear later? Any extra info would help in debugging. Thanks! On Wed Nov 05 2014 at 1:12:48 PM mfa213 notifications@github.com wrote:
Started GET "/admin" for 127.0.0.1 at 2014-11-06 02:07:14 +0800 ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations" Processing by Upmin::ModelsController#dashboard as HTML Rendered /Library/Ruby/Gems/2.0.0/gems/upmin-admin-0.1.0/app/views/upmin/models/dashboard.html.haml within layouts/upmin/application (2.3ms) Rendered /Library/Ruby/Gems/2.0.0/gems/upmin-admin-0.1.0/app/views/layouts/upmin/_navbar.html.haml (18.6ms) Completed 500 Internal Server Error in 187ms
ActionView::Template::Error (undefined method search_path' for
Class:0x007f88f2003098):
11: %ul.nav.navbar-nav 12: - Upmin::Model.all.each do |m| 13: %li 14: %a{href: m.search_path} 15: = m.humanized_name(:plural) activerecord (4.1.4) lib/active_record/dynamic_matchers.rb:26:in method_missing' upmin-admin (0.1.0) app/views/layouts/upmin/_navbar.html.haml:14:in block in ibraryubyems____gems_upmin_admin_____app_views_layouts_upminnavbar_html_haml_2687510834366968641_70113074058380' upmin-admin (0.1.0) app/views/layouts/upmin/_navbar.html.haml:12:ineach' upmin-admin (0.1.0) app/views/layouts/upmin/_navbar.html.haml:12:in `_ibraryubyems___gems_upmin_admin_____app_views_layouts_upminnavbar_html_haml___2687510834366968641_70113074058380'
— Reply to this email directly or view it on GitHub https://github.com/upmin/upmin-admin-ruby/issues/112.
i'm using rails 4.1.4 and ruby 2.0.0p481 i'm using upmin 0.1.01
Rails 4.1.5, similar issue. Upmin 0.1.01. ruby 2.1.2p95
Hi Jonathan, it certainly looks like it's triggered by the same method call, but a slightly different error (uninitialized constant vs. method missing). Both could have the same root cause though if Upmin::Model.all contains classes that shouldn't be there.
Please could you (and @mfa213) take a look in the rails console and see if Upmin::Model.all contains anything other than an array of models prefixed with Admin, e.g. [AdminOrder, AdminProduct, AdminUser]?
In my case (similar error message), I had both User
and AdminUser
(from a previous admin panel implementation).
Moving our AdminUser
out of the way made Upmin work
@mbrookes confirming that Upmin::Model.all
contains only an array of models prefixed with Admin, including Admin*Habtm*
models.
I think perhaps the problem lies with the fact that Upmin assumes that Habtm tables have a model (class) associated with them, which is not the case here.
Whitelisting the models that appear fixed the issue for me: https://github.com/upmin/upmin-admin-ruby/wiki/Configurations
Maybe the default should be to exclude Habtm models, so that users would have to include them manually.
@ernsheong Setting config.models was going to be my next suggestion :), but wanted to know what was causing your issue first. Glad you got it sorted! :+1:
Thanks for the info on Habtm - that came up in another issue yesterday, I'll look at getting a fix in over the next week or two, but feel free to submit a PR if you have an opportunity. :wink:
Started GET "/admin" for 127.0.0.1 at 2014-11-06 02:07:14 +0800 ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations" Processing by Upmin::ModelsController#dashboard as HTML Rendered /Library/Ruby/Gems/2.0.0/gems/upmin-admin-0.1.0/app/views/upmin/models/dashboard.html.haml within layouts/upmin/application (2.3ms) Rendered /Library/Ruby/Gems/2.0.0/gems/upmin-admin-0.1.0/app/views/layouts/upmin/_navbar.html.haml (18.6ms) Completed 500 Internal Server Error in 187ms
ActionView::Template::Error (undefined method
search_path' for #<Class:0x007f88f2003098>): 11: %ul.nav.navbar-nav 12: - Upmin::Model.all.each do |m| 13: %li 14: %a{href: m.search_path} 15: = m.humanized_name(:plural) activerecord (4.1.4) lib/active_record/dynamic_matchers.rb:26:in
method_missing' upmin-admin (0.1.0) app/views/layouts/upmin/_navbar.html.haml:14:inblock in ___ibrary__uby__ems_______gems_upmin_admin_______app_views_layouts_upmin__navbar_html_haml___2687510834366968641_70113074058380' upmin-admin (0.1.0) app/views/layouts/upmin/_navbar.html.haml:12:in
each' upmin-admin (0.1.0) app/views/layouts/upmin/_navbar.html.haml:12:in `ibraryubyems____gems_upmin_admin_____app_views_layouts_upminnavbar_html_haml___2687510834366968641_70113074058380'