Skip to content
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

Merged
merged 2 commits into from
Jul 2, 2019

Commits on Jul 2, 2019

  1. Rename login_url method

    `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`.
    swalkinshaw authored and chrisbutcher committed Jul 2, 2019
    Configuration menu
    Copy the full SHA
    d1fb114 View commit details
    Browse the repository at this point in the history
  2. Policial fixes

    chrisbutcher committed Jul 2, 2019
    Configuration menu
    Copy the full SHA
    0bc124b View commit details
    Browse the repository at this point in the history