ruby on rails - How to add ScriptTag on shopify_api gem? -
hi everyone,
i came across on problem can't figure out myself, believe expertise can me through solving error whenever try access route add script. here controller code:
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
and route file is:
controller :sessions 'login' => :new, :as => :login post 'login' => :create, :as => :authenticate 'auth/shopify/callback' => :callback 'logout' => :destroy, :as => :logout end root :to => 'home#index' match "script/", :to => "home#script", :via => :get
i want add script accessing route: on index view:
<h3>add shopperapproved site id:</h3> https://shopperapproved.herokuapp.com/script --> if going click link redirected homecontroller#script
i hope can me..
have set seesion & token? fnot cant create script in store
https://github.com/shopify/shopify_api
i assume did not set session cant "connect" store.
verify have valide session , work
Comments
Post a Comment