Keval
Keval

Reputation: 103

shopify is not a class

I am having a Shopify plugin which gave me an error of shopify is not a class

Model name: Class Shopify

embeded_one: shopify

webhooks jobs class name: class Shopify

I am using shopify app gem for building a shopify a plugin. also, I am using rails 5.1 and mongoid 7.0

class Shopify::Webhooks::ProductsUpdateJob < ApplicationJob
  queue_as :default

  def perform(*args)
    # Do something later
    puts("Product Updated Job called...!!")
    user = User.find_by({"shopify.domain": domain})
    # perform weebhooks

problem is I have the same project structure for my other Shopify app but it's run and build successfully in production.

Upvotes: 1

Views: 244

Answers (1)

mahemoff
mahemoff

Reputation: 46509

It looks like Shopify::Webhooks::ProductsUpdateJob is being evaluated before Shopify is defined.

Try this:

module Shopify
  module Webhooks
    class ProductsUpdateJob < ApplicationJob
      ...
    end
  end
end

(Also, I wouldn't recommend naming your own module Shopify at top level, being a third-party platform.)

Upvotes: 1

Related Questions