-
Notifications
You must be signed in to change notification settings - Fork 66
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
Comments
What version of rails, ruby, and any gems you can share the versions of?
|
i'm using rails 4.1.4 and ruby 2.0.0p481 |
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 Moving our |
@mbrookes confirming that 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: 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! 👍 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. 😉 |
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:in
each'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'
The text was updated successfully, but these errors were encountered: