Ruby on rails 如何在shopify_api gem上添加ScriptTag?
大家好, 我遇到了一个我自己无法真正理解的问题,我相信您的所有专业知识都可以帮助我解决每当我尝试访问路径以添加脚本时遇到的错误。这是我的控制器代码:Ruby on rails 如何在shopify_api gem上添加ScriptTag?,ruby-on-rails,shopify,Ruby On Rails,Shopify,大家好, 我遇到了一个我自己无法真正理解的问题,我相信您的所有专业知识都可以帮助我解决每当我尝试访问路径以添加脚本时遇到的错误。这是我的控制器代码: class HomeController < AuthenticatedController def index @products = ShopifyAPI::Product.find(:all, :params => {:product_type => "Underarmour"}) # script =
class HomeController < AuthenticatedController
def index
@products = ShopifyAPI::Product.find(:all, :params => {:product_type => "Underarmour"})
# script = ShopifyAPI::ScriptTag.new(:all, :params => {:event => "onload", :src => "https://shopperapproved.herokuapp.com/sajs/14043.js"})
end
def script
ShopifyAPI::ScriptTag.create(:event => "onload", :src => "https://shopperapproved.herokuapp.com/sajs/14043.js")
end
end
我想通过访问以下路径添加脚本:在我的索引视图上:
<h3>Add your ShopperApproved site ID:</h3>
https://shopperapproved.herokuapp.com/script --> if i am going to click this link i will be redirected to HomeController#script
添加您的ShopperApproved站点ID:
https://shopperapproved.herokuapp.com/script -->如果我要单击此链接,我将被重定向到HomeController#脚本
我希望您能帮助我。您是否设置了Seision&token?我知道你不能在你的商店里创建脚本 我假设您没有设置会话,因此无法“连接”到您的商店。
确认您有一个valide会话,它将工作 <h3>Add your ShopperApproved site ID:</h3> https://shopperapproved.herokuapp.com/script --> if i am going to click this link i will be redirected to HomeController#script