Shopify_app: undefined method `api_version' for #<ShopifyShop:0x00007ff590685348

Created on 21 May 2019  路  7Comments  路  Source: Shopify/shopify_app

When i try to update the access token on a ShopifyShop object in my database i get:

undefined method api_version' for #<ShopifyShop:0x00007ff590685348

My code is just:

shop.update_attributes(shopify_token: token) if shop

In my ShopifyShop model i do include include ShopifyApp::SessionStorage

Anyone know why this error keeps being thrown?

bug

Most helpful comment

@nwtn Just tested it.

After following these instructions it worked:

Configuration change

Add an api version configuration in config/initializers/shopify_app.rb Set this to the version you want to run against by default. See Shopify API docs for versions available.

config.api_version = '2019-04'

Session storage change

You will need to add an api_version method to you session storage object. The default implmentation for this is.

def api_version
ShopifyApp.configuration.api_version
end

My fault for not reading the changelog.

All 7 comments

yes me too.

@iamricks @heldopslippers

I got similar issue during upgrade to the latest shopify_app gem version.

I regenerated code with $ rails generate shopify_app:install and also did these https://github.com/Shopify/shopify_app#upgrading-from-86-to-900 changes and now it's all working for me.

@iamricks @heldopslippers did @andreas-sotnik-2k19鈥檚 solution work for you?

@nwtn Just tested it.

After following these instructions it worked:

Configuration change

Add an api version configuration in config/initializers/shopify_app.rb Set this to the version you want to run against by default. See Shopify API docs for versions available.

config.api_version = '2019-04'

Session storage change

You will need to add an api_version method to you session storage object. The default implmentation for this is.

def api_version
ShopifyApp.configuration.api_version
end

My fault for not reading the changelog.

@iamricks hey im having the same issue - i cant for the life of me figure out where I'm supposed to put

def api_version
  ShopifyApp.configuration.api_version
end

could you help me out?

a little more info..
in my shopify_app file i have included this

  config.session_repository = Shop
  config.api_version = '2019-04'

and in my shop.rb file ive tried this

class Shop < ActiveRecord::Base
  include ShopifyApp::SessionStorage
  def api_version
    ShopifyApp.configuration.api_version
  end

and it returns the same error
NoMethodError: undefined methodapi_version=' for #

@seshna Have you figured it out? I have the same issue...

@Rasovsky my shopify_app and shopiy_api gems both needed to be updated, and with the code i wrote above, it worked.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

robbyklein picture robbyklein  路  4Comments

MisinformedDNA picture MisinformedDNA  路  6Comments

shravanjoopally picture shravanjoopally  路  10Comments

skillmatic-co picture skillmatic-co  路  6Comments

sayduck-daniel picture sayduck-daniel  路  5Comments