Quantcast
Channel: Opinion: Shopify Community - Shopify APIs & SDKs
Viewing all articles
Browse latest Browse all 25503

Rails - shopify_app by kilua gank

$
0
0

Hi,

Based on the readme of this gem/plugin

it suggested to create a model and assign it into ShopifySessionRepository.storage right

the model could be something like this 

 


class Shop < ActiveRecord::Base

def self.store(session)

shop = Shop.new(domain: session.url, token: session.token)

shop.save! shop.id end

def self.retrieve(id)

if shop = Shop.where(id: id).first

ShopifyAPI::Session.new(shop.domain, shop.token)

end

end

end
 

hmm I have changed it to follow the readme, one thing tho, so first time shop install/login into the app, it will create record for it into the Shop model right, and if the same shop re-login again, supposedly it uses the one that in the record instead of create the new record.

So if the same shop login 5 times, it will create 5 records, I think this is wrong..

 


Viewing all articles
Browse latest Browse all 25503

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>