Skip to content
This repository has been archived by the owner on Nov 6, 2023. It is now read-only.

Internal call to 'route_set.recognize_path' fails with multiple mounted engines #5

Open
domaindrivendev opened this issue May 18, 2016 · 0 comments

Comments

@domaindrivendev
Copy link
Contributor

domaindrivendev commented May 18, 2016

Consider the following application routes ...

  Rails.application.routes.draw do
    mount CareManagement::Engine => '/care'
    mount CarePlanning::Engine => '/care_planning'
  end

If you try to access a "roles_on_routes protected" route in the CarePlanning engine e.g. "GET /care_planning/resources", then roles_on_routes throws the following error:

ActionController::RoutingError (No route matches "/care_planning/resources"):
actionpack (3.2.22.2) lib/action_dispatch/routing/route_set.rb:642:in recognize_path' /opt/boxen/rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/bundler/gems/roles_on_routes-b502875b3d89/lib/roles_on_routes/engine_aware_route_set.rb:31:inrecognize_path'

HOWEVER ..........

If you switch the order of mounts in routes.rb, then it appears to work without any problems

  Rails.application.routes.draw do
    mount CarePlanning::Engine => '/care_planning'
    mount CareManagement::Engine => '/care'
  end

So, it looks like both mounts starting with the same text (e.g. '/care') is causing the problem. Weird!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant