Skip to content

Commit

Permalink
fix main app or engine url helper
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinhughes27 committed Jul 19, 2017
1 parent 4c8f91c commit 8acbcd1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
8 changes: 0 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,14 +199,6 @@ This will create the Shopify engine routes under the specified subpath, as a res
callback_path: '/nested/auth/shopify/callback'
```

To use named routes with the engine so that it can route between the application and the engine's routes it should be prefixed with `main_app` or `shopify_app`.

```ruby
main_app.login_path # For a named login route on the rails app.

shopify_app.login_path # For the shopify app store login route.
```

Managing Api Keys
-----------------

Expand Down
7 changes: 6 additions & 1 deletion lib/shopify_app/controller_concerns/login_protection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def close_session
def main_or_engine_login_url(params = {})
main_app.login_url(params)
rescue NoMethodError
shopify_app.login_url(params)
shopify_app_engine.login_url(host: "https://#{request.host}", params: params)
end

def fullpage_redirect_to(url)
Expand Down Expand Up @@ -115,5 +115,10 @@ def sanitize_shop_param(params)
ShopifyApp::Utils.sanitize_shop_domain(params[:shop])
end

private

def shopify_app_engine
ShopifyApp::Engine.routes.url_helpers
end
end
end

0 comments on commit 8acbcd1

Please sign in to comment.