Lazily define engine routes using routes do ... end #5505
+7
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #5500
At least, I think it should fix that issue, but my tests fail with:
which is raised from the
.html.erbviews code.graphql_dashboard.<some_view_path>works fine in the test files, but not in the views 😖I have been trying to trace through initializer code and RouteSet code to figure out what's missing, but I haven't been able
to.
UPDATE: Trying to debug, I tried calling the route methods in the engine's controller methods, ie
def show; puts graphql_dashboard.delete_all_detailed_traces_path; end. It raised a more helpful error:And indeed, including the url helpers (the engine's url helpers in this case) did fix my problem. In order to keep the routes lazy-loaded, I put the
.includecall inside theroutes do ... endblock.