Fix error Gem Load Error is: uninitialized constant when run a gem in project

I a newbie, and i write a gem use to scraper google play my gem here

But when i install gem in project, then error:

Gem Load Error is: uninitialized constant

I do not know any way to fix or maybe give me instructions or keywords to modify them. Thanks for the help

Upvotes: 2

Views: 653

Answers (1)

Roy Cruz
Roy Cruz

Reputation: 79

I check your code, it appears that if you change the require of the files that you created for require relative it could fetch the files. Also, you are using the module directly on the classes, so you need to define first the module before making the requirement of the classes.

module ScraperGooglePlay
  def self.lorem
    "lorem"
  end
end

require 'mechanize' # and any other gems you need
require 'active_support/all'
require_relative 'scraper_google_play/base'
require_relative 'scraper_google_play/app'
require_relative 'scraper_google_play/category'
require_relative 'scraper_google_play/search'

Upvotes: 3

Related Questions