Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

178
Views
NameError: constante no inicializada Crawler::ScraperService on rails c

Estoy tratando de ejecutar una clase en Rails c para depurar en un proyecto de Rails, duh, pero sigo recibiendo mensajes de error de nombre:

 #app/services/scraper_service.rb module Crawler class ScraperService URL_HOST = 'http://quotes.toscrape.com/page/1/' def initialize(tag) @tag = tag end def self.get_url agent = Mechanize.new binding.pry page = agent.get(URL_HOST) end end end

Cuando trato de instanciar la clase en los rieles c, obtengo esto:

 > Crawler::ScraperService.new('love').get_url NameError: uninitialized constant Crawler::ScraperService from (pry):5:in `<main>'

O sin el método de inicialización (por supuesto, en este caso está fuera del código):

 > Crawler::ScraperService.get_url NameError: uninitialized constant Crawler::ScraperService from (pry):7:in `<main>'

Sé que es una cosa pequeña, pero estoy tratando de entender esto.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Oh sí. Mejor nunca olvides el "::" antes de este tipo de llamada.

Manera correcta:

::Crawler::ScraperService.get_url con los dos :: antes de todas las clases.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!