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

NoMethodError: undefined method admin_images_url #3143

Closed
edmunteanu opened this issue Mar 14, 2019 · 3 comments
Closed

NoMethodError: undefined method admin_images_url #3143

edmunteanu opened this issue Mar 14, 2019 · 3 comments
Labels
type:bug Error, flaw or fault

Comments

@edmunteanu
Copy link

When logged in as an admin, attempting to send requests to the ImagesController with an inexistent product doesn't redirect to the 404 page, but to an undefined admin_images_url, which throws an error.

Solidus Version:
2.6.3

To Reproduce
In order to reproduce this problem, simply follow this path: admin/products/:inexistent_product/images.

Current behavior
The actual implementation of the ResourceController rescues the RecordNotFound error with the resource_not_found method, which redirects you to the collection_url. This collection_url method then creates a polymorphic path out of the admin namespace and the resource, which creates the undefined admin_images_url.

Expected behavior
What I would expect to happen, when you send such a request, is a 404 page telling you that the product/page you are looking for doesn't exist.

Desktop / Smartphone:
This is not an issue which depends on a device / browser.

Stacktrace:

NoMethodError: undefined method `admin_images_url' for #<ActionDispatch::Routing::RoutesProxy:0x00007fb7a48c4f70>
Did you mean?  admin_product_images_url
  from action_dispatch/routing/routes_proxy.rb:47:in `method_missing'
  from action_dispatch/routing/polymorphic_routes.rb:230:in `polymorphic_method'
  from action_dispatch/routing/polymorphic_routes.rb:114:in `polymorphic_url'
  from spree/admin/resource_controller.rb:262:in `collection_url'
  from spree/admin/resource_controller.rb:130:in `resource_not_found'
  from active_support/rescuable.rb:107:in `call'
  from active_support/rescuable.rb:107:in `block in handler_for_rescue'
  from active_support/rescuable.rb:91:in `rescue_with_handler'
  from active_support/rescuable.rb:164:in `rescue_with_handler'
  from action_controller/metal/rescue.rb:23:in `rescue in process_action'
  from action_controller/metal/rescue.rb:19:in `process_action'
  from action_controller/metal/instrumentation.rb:32:in `block in process_action'
  from active_support/notifications.rb:166:in `block in instrument'
  from active_support/notifications/instrumenter.rb:21:in `instrument'
  from active_support/notifications.rb:166:in `instrument'
  from action_controller/metal/instrumentation.rb:30:in `process_action'
  from action_controller/metal/params_wrapper.rb:252:in `process_action'
  from active_record/railties/controller_runtime.rb:22:in `process_action'
  from abstract_controller/base.rb:124:in `process'
  from action_view/rendering.rb:30:in `process'
  from action_controller/metal.rb:189:in `dispatch'
  from action_controller/metal.rb:253:in `dispatch'
  from action_dispatch/routing/route_set.rb:49:in `dispatch'
  from action_dispatch/routing/route_set.rb:31:in `serve'
  from action_dispatch/journey/router.rb:50:in `block in serve'
  from action_dispatch/journey/router.rb:33:in `each'
  from action_dispatch/journey/router.rb:33:in `serve'
  from action_dispatch/routing/route_set.rb:844:in `call'
  from rails/engine.rb:522:in `call'
  from rails/railtie.rb:185:in `public_send'
  from rails/railtie.rb:185:in `method_missing'
  from action_dispatch/routing/mapper.rb:17:in `block in <class:Constraints>'
  from action_dispatch/routing/mapper.rb:46:in `serve'
  from action_dispatch/journey/router.rb:50:in `block in serve'
  from action_dispatch/journey/router.rb:33:in `each'
  from action_dispatch/journey/router.rb:33:in `serve'
  from action_dispatch/routing/route_set.rb:844:in `call'
  from new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
  from new_relic/rack/agent_hooks.rb:30:in `traced_call'
  from new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
  from new_relic/rack/browser_monitoring.rb:32:in `traced_call'
  from new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
  from warden/manager.rb:36:in `block in call'
  from warden/manager.rb:35:in `catch'
  from warden/manager.rb:35:in `call'
  from new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
  from rack/etag.rb:25:in `call'
  from new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
  from rack/conditional_get.rb:25:in `call'
  from new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
  from rack/head.rb:12:in `call'
  from new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
  from rack/session/abstract/id.rb:232:in `context'
  from rack/session/abstract/id.rb:226:in `call'
  from new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
  from action_dispatch/middleware/cookies.rb:613:in `call'
  from new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
  from action_dispatch/middleware/callbacks.rb:26:in `block in call'
  from active_support/callbacks.rb:97:in `run_callbacks'
  from action_dispatch/middleware/callbacks.rb:24:in `call'
  from new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
  from action_dispatch/middleware/debug_exceptions.rb:59:in `call'
  from new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
  from action_dispatch/middleware/show_exceptions.rb:31:in `call'
  from new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
  from lograge/rails_ext/rack/logger.rb:15:in `call_app'
  from rails/rack/logger.rb:24:in `block in call'
  from active_support/tagged_logging.rb:69:in `block in tagged'
  from active_support/tagged_logging.rb:26:in `tagged'
  from active_support/tagged_logging.rb:69:in `tagged'
  from rails/rack/logger.rb:24:in `call'
  from new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
  from action_dispatch/middleware/remote_ip.rb:79:in `call'
  from new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
  from request_store/middleware.rb:19:in `call'
  from new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
  from action_dispatch/middleware/request_id.rb:25:in `call'
  from new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
  from rack/method_override.rb:22:in `call'
  from new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
  from rack/runtime.rb:22:in `call'
  from new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
  from active_support/cache/strategy/local_cache_middleware.rb:27:in `call'
  from new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
  from action_dispatch/middleware/executor.rb:12:in `call'
  from new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
  from action_dispatch/middleware/static.rb:125:in `call'
  from new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
  from rack/sendfile.rb:111:in `call'
  from new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
  from action_dispatch/middleware/ssl.rb:68:in `call'
  from new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
  from raven/integrations/rack.rb:51:in `call'
  from new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
  from rails/engine.rb:522:in `call'
  from new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
  from puma/configuration.rb:225:in `call'
  from puma/server.rb:632:in `handle_request'
  from puma/server.rb:446:in `process_client'
  from puma/server.rb:306:in `block in run'
  from puma/thread_pool.rb:120:in `block in spawn_thread'

ActiveRecord::RecordNotFound: can't find record with friendly id: "test"
  from friendly_id/finder_methods.rb:70:in `raise_not_found_exception'
  from friendly_id/finder_methods.rb:23:in `find'
  from spree/admin/images_controller.rb:22:in `load_data'
  from active_support/callbacks.rb:413:in `block in make_lambda'
  from active_support/callbacks.rb:197:in `block (2 levels) in halting'
  from abstract_controller/callbacks.rb:12:in `block (2 levels) in <module:Callbacks>'
  from active_support/callbacks.rb:198:in `block in halting'
  from active_support/callbacks.rb:507:in `block in invoke_before'
  from active_support/callbacks.rb:507:in `each'
  from active_support/callbacks.rb:507:in `invoke_before'
  from active_support/callbacks.rb:106:in `block in run_callbacks'
  from raven/integrations/rails/controller_transaction.rb:7:in `block in included'
  from active_support/callbacks.rb:117:in `instance_exec'
  from active_support/callbacks.rb:117:in `block in run_callbacks'
  from active_support/callbacks.rb:135:in `run_callbacks'
  from abstract_controller/callbacks.rb:19:in `process_action'
  from action_controller/metal/rescue.rb:20:in `process_action'
  from action_controller/metal/instrumentation.rb:32:in `block in process_action'
  from active_support/notifications.rb:166:in `block in instrument'
  from active_support/notifications/instrumenter.rb:21:in `instrument'
  from active_support/notifications.rb:166:in `instrument'
  from action_controller/metal/instrumentation.rb:30:in `process_action'
  from action_controller/metal/params_wrapper.rb:252:in `process_action'
  from active_record/railties/controller_runtime.rb:22:in `process_action'
  from abstract_controller/base.rb:124:in `process'
  from action_view/rendering.rb:30:in `process'
  from action_controller/metal.rb:189:in `dispatch'
  from action_controller/metal.rb:253:in `dispatch'
  from action_dispatch/routing/route_set.rb:49:in `dispatch'
  from action_dispatch/routing/route_set.rb:31:in `serve'
  from action_dispatch/journey/router.rb:50:in `block in serve'
  from action_dispatch/journey/router.rb:33:in `each'
  from action_dispatch/journey/router.rb:33:in `serve'
  from action_dispatch/routing/route_set.rb:844:in `call'
  from rails/engine.rb:522:in `call'
  from rails/railtie.rb:185:in `public_send'
  from rails/railtie.rb:185:in `method_missing'
  from action_dispatch/routing/mapper.rb:17:in `block in <class:Constraints>'
  from action_dispatch/routing/mapper.rb:46:in `serve'
  from action_dispatch/journey/router.rb:50:in `block in serve'
  from action_dispatch/journey/router.rb:33:in `each'
  from action_dispatch/journey/router.rb:33:in `serve'
  from action_dispatch/routing/route_set.rb:844:in `call'
  from new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
  from new_relic/rack/agent_hooks.rb:30:in `traced_call'
  from new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
  from new_relic/rack/browser_monitoring.rb:32:in `traced_call'
  from new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
  from warden/manager.rb:36:in `block in call'
  from warden/manager.rb:35:in `catch'
  from warden/manager.rb:35:in `call'
  from new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
  from rack/etag.rb:25:in `call'
  from new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
  from rack/conditional_get.rb:25:in `call'
  from new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
  from rack/head.rb:12:in `call'
  from new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
  from rack/session/abstract/id.rb:232:in `context'
  from rack/session/abstract/id.rb:226:in `call'
  from new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
  from action_dispatch/middleware/cookies.rb:613:in `call'
  from new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
  from action_dispatch/middleware/callbacks.rb:26:in `block in call'
  from active_support/callbacks.rb:97:in `run_callbacks'
  from action_dispatch/middleware/callbacks.rb:24:in `call'
  from new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
  from action_dispatch/middleware/debug_exceptions.rb:59:in `call'
  from new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
  from action_dispatch/middleware/show_exceptions.rb:31:in `call'
  from new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
  from lograge/rails_ext/rack/logger.rb:15:in `call_app'
  from rails/rack/logger.rb:24:in `block in call'
  from active_support/tagged_logging.rb:69:in `block in tagged'
  from active_support/tagged_logging.rb:26:in `tagged'
  from active_support/tagged_logging.rb:69:in `tagged'
  from rails/rack/logger.rb:24:in `call'
  from new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
  from action_dispatch/middleware/remote_ip.rb:79:in `call'
  from new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
  from request_store/middleware.rb:19:in `call'
  from new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
  from action_dispatch/middleware/request_id.rb:25:in `call'
  from new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
  from rack/method_override.rb:22:in `call'
  from new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
  from rack/runtime.rb:22:in `call'
  from new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
  from active_support/cache/strategy/local_cache_middleware.rb:27:in `call'
  from new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
  from action_dispatch/middleware/executor.rb:12:in `call'
  from new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
  from action_dispatch/middleware/static.rb:125:in `call'
  from new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
  from rack/sendfile.rb:111:in `call'
  from new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
  from action_dispatch/middleware/ssl.rb:68:in `call'
  from new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
  from raven/integrations/rack.rb:51:in `call'
  from new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
  from rails/engine.rb:522:in `call'
  from new_relic/agent/instrumentation/middleware_tracing.rb:92:in `call'
  from puma/configuration.rb:225:in `call'
  from puma/server.rb:632:in `handle_request'
  from puma/server.rb:446:in `process_client'
  from puma/server.rb:306:in `block in run'
  from puma/thread_pool.rb:120:in `block in spawn_thread'
@aitbw
Copy link
Contributor

aitbw commented Mar 14, 2019

Hi @edmunteanu, thanks for reporting this issue! Unfortunately, I've been unable to reproduce this bug so far, both with master and v2.6.3

I do see an error though, which is:

ActiveRecord::RecordNotFound in Spree::Admin::ImagesController#index
can't find record with friendly id: "some-id"

If you can provide us with some extra details (i.e.: configuration, extensions in use), that'd be great! 🙌

@seand7565
Copy link
Contributor

I have replicated this on 2.10

image

@aldesantis
Copy link
Member

Closing in favor of #3604 which encompasses this and other issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Error, flaw or fault
Projects
None yet
Development

No branches or pull requests

5 participants