I’m having trouble importing a ruby file

Asked

Viewed 38 times

-1

I am trying to import a ruby file using require and the require_relative but I always get this mistake Traceback (most recent call last): 1: from app.ruby:1:in ' app.ruby:1:in require_relative': cannot load such file -- C:/xampp/htdocs/some-ruby-projects/project-10/product.ruby (LoadError)

Someone can give me a light?

my code

require_relative 'product.ruby'
require_relative 'market.ruby'

product = Product.new
market = Market.new(product)

product.price = "3.990"
product.name = "Iphone 6s"
market.buy(product)

1 answer

0

Take the extension . ruby and replace it with . Rb and instead of putting require_relative 'product.ruby' and require_relative 'market.ruby' leave only 'product' and 'market', because beyond the extension . ruby does not exist it is not necessary to put any extension when using require_relative as it will look for another file through the string that was placed between ''

Browser other questions tagged

You are not signed in. Login or sign up in order to post.