Skip to content

Conversation

arkirchner
Copy link
Contributor

  • RFC6570 paths need to include the Rails Engines prefix.
  • Route parameter support keyword arguments and an options Hash.

Copy link

codecov bot commented Sep 12, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (dd6a80f) to head (09eeb64).

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #42   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            4         4           
  Lines          162       161    -1     
=========================================
- Hits           162       161    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Owner

Choose a reason for hiding this comment

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

Does the engine need to be a gem? This feels like adding a lot of unrelated churn.

If the engine is only needed in tests, can it be defined/loaded only there?

end

define_method(rfc6570_path_name) do |**opts|
define_method(rfc6570_path_name) do |opts = {}|
Copy link
Owner

Choose a reason for hiding this comment

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

Why's this needed? 👀

Copy link
Contributor Author

@arkirchner arkirchner Sep 15, 2025

Choose a reason for hiding this comment

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

  • Support for options hash for *_rfc6570 to support Rails Engines.

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.

Comment on lines 28 to 37
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)
Copy link
Owner

Choose a reason for hiding this comment

The 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 path_only: true much more like a full URL? Is that the important change for supporting engines?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, the original version removed the engines mount path.

/some_engine/users was resolved to just /users.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fix up *_path_rfc6570 to include Rails Engines mount point.

Basically the previous version would ignore script_name for paths.

Copy link
Owner

@jgraichen jgraichen 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 for contributing!

I've added some notes and would need some more clarification about which specific changes do what. I do need to understand the changes and intentions so that I can continue to maintain that.

Please add them to the commit(s) and PR description so that they are preserved.

@jgraichen
Copy link
Owner

I inlined the engine and squashed all commits but couldn't force-push correctly into this PR. I've put your changes on the pr-42 branch and will merge them.

@arkirchner
Copy link
Contributor Author

Thank you!

@jgraichen
Copy link
Owner

Has been released with 3.5.0.

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.

2 participants