-
Notifications
You must be signed in to change notification settings - Fork 3
fix: Support Rails Engines #42
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,19 +25,16 @@ def evaluate(ctx:, ignore: %w[format], **kwargs) | |
end | ||
end | ||
|
||
if kwargs.fetch(:path_only, false) | ||
::Addressable::Template.new parts.join | ||
else | ||
options = ctx.url_options.merge(kwargs) | ||
options[:path] = parts.join | ||
|
||
if (osn = options.delete(:original_script_name)) | ||
options[:script_name] = osn + options[:script_name] | ||
end | ||
options = ctx.url_options.merge(kwargs) | ||
options[:path] = parts.join | ||
options[:only_path] = kwargs.fetch(:path_only, false) | ||
|
||
::Addressable::Template.new \ | ||
ActionDispatch::Http::URL.url_for(options) | ||
if (osn = options.delete(:original_script_name)) | ||
options[:script_name] = osn + options[:script_name] | ||
end | ||
|
||
::Addressable::Template.new \ | ||
ActionDispatch::Http::URL.url_for(options) | ||
Comment on lines
+28
to
+37
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems to be the primary change here, but it is very similar to before. What's the important change here? It handles There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, the original version removed the engines mount path.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Basically the previous version would ignore |
||
end | ||
|
||
def symbol(node, prefix: nil, suffix: nil) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module DummyEngine | ||
class ApplicationController < ActionController::API | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module DummyEngine | ||
class Engine < ::Rails::Engine | ||
isolate_namespace DummyEngine | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why's this needed? 👀
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When used in a Rails engine, the options are a hash. I was able to reproduce this issue loading the engine; however, this seems to no longer be the case.
I am investigating.