Answer the question
In order to leave comments, you need to log in
Worker in rails doesn't know the route?
Gemfile gem 'resque', :require => 'resque/server'
routes.rb
get '/товар/:id', :to => 'goods#show', :as => :good
class MyJob
@queue = :my_job
def self.perform
g = Goods.where(:id => 1).first
good_path(g),
end
end
undefined local variable or method `good_path' for MyJob:Class
Answer the question
In order to leave comments, you need to log in
Try Rails.application.routes.url_helpers.good_path(g)
Thanks Andrey Nikiforov
include ActionDispatch::Routing::UrlFor
include ActionController::PolymorphicRoutes
include Rails.application.routes.url_helpers
default_url_options[:host] = 'example.com'
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question