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

ActionView::Template::Error - undefined method search_path #112

Open
furqan85 opened this issue Nov 5, 2014 · 8 comments
Open

ActionView::Template::Error - undefined method search_path #112

furqan85 opened this issue Nov 5, 2014 · 8 comments
Labels

Comments

@furqan85
Copy link

furqan85 commented Nov 5, 2014

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:inmethod_missing'
upmin-admin (0.1.0) app/views/layouts/upmin/_navbar.html.haml:14:in block 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:ineach'
upmin-admin (0.1.0) app/views/layouts/upmin/_navbar.html.haml:12:in `___ibrary__uby__ems_______gems_upmin_admin_______app_views_layouts_upmin__navbar_html_haml___2687510834366968641_70113074058380'

@joncalhoun
Copy link
Member

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 [email protected] 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
___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:ineach'
upmin-admin (0.1.0) app/views/layouts/upmin/_navbar.html.haml:12:in
`___ibrary__uby__ems_______gems_upmin_admin_______app_views_layouts_upmin__navbar_html_haml___2687510834366968641_70113074058380'


Reply to this email directly or view it on GitHub
#112.

@furqan85
Copy link
Author

furqan85 commented Nov 7, 2014

i'm using rails 4.1.4 and ruby 2.0.0p481
i'm using upmin 0.1.01

@ernsheong
Copy link

Rails 4.1.5, similar issue. Upmin 0.1.01. ruby 2.1.2p95

screen shot 2014-11-12 at 11 35 38 am

@mbrookes
Copy link
Contributor

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]?

@amuino
Copy link

amuino commented Nov 17, 2014

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

@ernsheong
Copy link

@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.

@ernsheong
Copy link

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.

@mbrookes
Copy link
Contributor

@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! 👍

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. 😉

@mbrookes mbrookes added the bug label Nov 19, 2014
@mbrookes mbrookes self-assigned this Nov 19, 2014
@mbrookes mbrookes changed the title Getting this error while accessing admin panel ActionView::Template::Error - undefined method search_path Nov 19, 2014
@mbrookes mbrookes removed their assignment Feb 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants