Skip to content

Ignore relative_url_root if generating prefix#20958

Closed
merhard wants to merge 1 commit intorails:4-2-stablefrom
merhard:engine_named_routes_fix
Closed

Ignore relative_url_root if generating prefix#20958
merhard wants to merge 1 commit intorails:4-2-stablefrom
merhard:engine_named_routes_fix

Conversation

@merhard
Copy link
Copy Markdown
Contributor

@merhard merhard commented Jul 20, 2015

When generating the url for a mounted engine through its proxy (e.g. foo.bar_path), the relative_url_root should not be used when generating the proxy’s url prefix.

(fixes #20920)

When generating the url for a mounted engine through its proxy (e.g. foo.bar_path), the relative_url_root should not be used when generating the proxy’s url prefix.

(fixes rails#20920)
@merhard
Copy link
Copy Markdown
Contributor Author

merhard commented Aug 14, 2015

@rafaelfranca, any chance to get this into v4.2.4? It is a fix for a regression in v4.2.3

@shawnstephens
Copy link
Copy Markdown

When will this be merged and released?

merhard pushed a commit to merhard/rails that referenced this pull request Sep 23, 2015
When generating the url for a mounted engine through its proxy, the path should be the sum of three parts:

1. Any `SCRIPT_NAME` request header or the value of `relative_url_root`.
2. A prefix (the engine's mounted path).
3. The path of the named route inside the engine.

Since commit rails@0703453, this has been broken. Instead, the path is the sum of four parts:

1. Any `SCRIPT_NAME` request header or the value of `relative_url_root`.
2. The value of `relative_url_root`.
3. A prefix (the engine's mounted path).
4. The path of the named route inside the engine.

This commit fixes the regression by providing a benign truthy value for `options[:script_name]` (an empty string) when the prefix is being generated, avoiding the duplicate `relative_url_root` value in the final result.

This resolves rails#20920, resolves rails#21459, and closes rails#20958
@merhard
Copy link
Copy Markdown
Contributor Author

merhard commented Sep 24, 2015

Fyi, I added a new pull request with another solution to the issue this attempts to solve. #21743 Hopefully one of these two solutions can be merged soon so the issue can be resolved.

merhard pushed a commit to merhard/rails that referenced this pull request Sep 28, 2015
When generating the url for a mounted engine through its proxy, the path should be the sum of three parts:

1. Any `SCRIPT_NAME` request header or the value of `relative_url_root`.
2. A prefix (the engine's mounted path).
3. The path of the named route inside the engine.

Since commit rails@44ff031, this has been broken. Instead, the path is the sum of four parts:

1. Any `SCRIPT_NAME` request header or the value of `relative_url_root`.
2. The value of `relative_url_root`.
3. A prefix (the engine's mounted path).
4. The path of the named route inside the engine.

This commit fixes the regression by providing a benign truthy value for `options[:script_name]` (an empty string) when the prefix is being generated, avoiding the duplicate `relative_url_root` value in the final result.

This resolves rails#20920, resolves rails#21459, and closes rails#20958
@merhard
Copy link
Copy Markdown
Contributor Author

merhard commented Oct 7, 2015

Closing this in favor of #21804

@merhard merhard closed this Oct 7, 2015
@merhard merhard deleted the engine_named_routes_fix branch October 7, 2015 16:12
@abdul-wahab-qbatch
Copy link
Copy Markdown

can you please share a patch that I can apply in my app, right now

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.

4 participants