-
Notifications
You must be signed in to change notification settings - Fork 699
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
Rename login_url
method to login_url_with_optional_shop
to avoid ambiguity with Rails' route helper method of the same name
#585
Conversation
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.
Makes sense. Unfortunately, a ton of apps use protected methods so this will be a breaking change for some folks.
Should this be a major version change?
Putting this here so it's top of mind, but I would love for us to move away from protected methods all together.
I've also hit this issue: Issue with I'd love to see this change. Maybe in v9. |
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.
LGTM, and I agree about the bump to 9.0
I've again spent several days tracking down this issue. Can you please merge it? That would be really appreciated! |
I'll rebase and ship this today. |
66a03d5
to
55a3ad0
Compare
e60cc43
to
7a1c6e8
Compare
cc: @Hammadk @EiNSTeiN- Can I get another quick review of this PR? |
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.
LGTM
👋 @Shopify/platform-dev-tools-education Can I also get another review from one of you? |
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.
looks good. @chrisbutcher lmk if you need me to 🎩, otherwise feel free to merge.
+1 to doing a major release for this. there may be some other breaking changes we can bundle in with a release this week
Thanks @nwtn !
Actually, that would be super helpful, if you don't mind :) |
Thanks guys for getting back on this right away! 👍 Edit: I guess the major version bump is to v10 now. |
login_url
method to login_url_with_optional_shop
login_url
method to login_url_with_optional_shop
login_url
method to login_url_with_optional_shop
to avoid ambiguity with Rails' route helper method of the same name
@swalkinshaw would like to get another PR merged into |
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.
🎩✔️
I was really hoping this change got merged into the new major version bump... :( |
`login_url` potentially conflicts with Rails' route helper methods which are auto generated. Since this engine defines a `login` route, `login_url` would be the generated method. While this doesn't cause problems in normal use cases, if the same route is defined in the main app's route to point to a customized sessions controller (for example), the route helper method `login_url` will take precedence causing redirects to happen *without* the `shop` param. ie: ```ruby Rails.application.routes.draw do get 'login', to: 'sessions#new', as: :login mount ShopifyApp::Engine, at: '/' end ``` Even though this is guarding against an uncommon edge case, there's no reason to keep the conflicting method name. This simply renames it to `login_url_with_optional_shop`.
7a1c6e8
to
0bc124b
Compare
I just saw this got merged in v11. Wow! Thank you so much, for making a major version bump just for this PR! I really appreciate it! ❤️ 🎉 |
No worries! Sorry it slipped from our list of changes to include in v10 :) |
Could this be documented in the README as a breaking change when upgrading to v11? It's only mentioned in the changelog. |
login_url
potentially conflicts with Rails' route helper methods which are auto generated. Since this engine defines alogin
route,login_url
would be the generated method.While this doesn't cause problems in normal use cases, if the same route is defined in the main app's route to point to a customized sessions controller (for example), the route helper method
login_url
will take precedence causing redirects to happen without theshop
param.ie:
Even though this is guarding against an uncommon edge case, there's no reason to keep the conflicting method name.
This simply renames it to
login_url_with_optional_shop
.NOTE: I guess this is a potentially breaking change if anyone had overridden
login_url
previously even though it's a protected method.