I need to get the current shop's domain (I do this using ShopifyAPI::Shop.current.domain). This works in the HomeController and can display it in home/index.html.erb. But, when I try to call ShopifyAPI::Shop.current.domain in my CustomController to display in a different view, I get the error Missing site URI.
I think this is because once the user leaves the home/index view it no longer has access to that Shop instance. So, how can I recreate that instance in my CustomController if I don't know the id. For example, this works:
@shop = Shop.find(1)
@domain = @shop.shopify_domain
But, I will not always know the shop's id in the model.
Or, maybe I am approaching this the wrong way.
Aucun commentaire:
Enregistrer un commentaire