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

Handle Rails engine routes #38

Merged
merged 3 commits into from
Mar 24, 2022
Merged

Handle Rails engine routes #38

merged 3 commits into from
Mar 24, 2022

Conversation

blocknotes
Copy link
Contributor

@blocknotes blocknotes commented Mar 17, 2022

Let iterate all the recognized routes including the ones coming from Rails engines.

As reference, the relevant part of action_dispatch's recognize:
https://github.com/rails/rails/blob/main/actionpack/lib/action_dispatch/routing/route_set.rb#L881-L892

Fixes #37

@blocknotes blocknotes changed the title Fix for engine routes Fix engine routes Mar 18, 2022
@blocknotes blocknotes changed the title Fix engine routes Handle Rails engine routes Mar 18, 2022
@blocknotes blocknotes marked this pull request as ready for review March 19, 2022 20:52
unless route.path.anchored
route = find_rails_route(request, app: route.app.app, fix_path: false)
found_route = nil
if app.respond_to? :routes
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests don't fail even if you don't check if app.respond_to? :routes. Please remove this check or add a test that fails without this check.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed in 81751cb

@k0kubun
Copy link
Collaborator

k0kubun commented Mar 24, 2022

To mitigate the risk of this change, I removed changes that are not needed to pass the test case. 81751cb

Copy link
Collaborator

@k0kubun k0kubun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@k0kubun k0kubun merged commit 6931c92 into exoego:master Mar 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"No route matched for" error when using engine routes
2 participants