Ad

Why Are My Rails Helpers Not Working With Shopify_app Gem?

I upgraded the shopify_app gem in my Shopify application from 7.x to 8.x and rails helpers stopped working properly.

What's going on?

Ad

Answer

Inheriting from ShopifyApp::AuthenticatedController in the controller hierarchy used to work.

As of shopify_app gem version 8 the Rails helpers seem to break, at least in some cases.

Instead of inheriting from the ShopifyApp::AuthenticatedController (which remains in the gem for backwards-compatibility) you can include the ShopifyApp::Authenticated concern. This should make the helpers work again. From the example app:

class AuthenticatedController < ApplicationController
  include ShopifyApp::Authenticated
end

More info in the gem documentation.

If that does not work or isn't an option for you, this medium post has another approach for including helpers.

Ad
source: stackoverflow.com
Ad