Search code examples
ruby-on-railssidekiq

why executing a controller that triggers a job outputs integers?


I'm new to Rails.

I have a simple controller with a method that triggers a job. I have sidekiq running. When I try to execute it from the console, the output is a series of integers. What does it mean?

controller:

class DownloadersController

 def email
  Jobs.enqueue(:send_download_drive_link, to_address: '[email protected]', drive_url: 'www.google.com')
 end

end

In my console, I run the following:

[6] pry(main)> x = DownloadersController.new
=> #<DownloadersController:0x007fd2f31a8a88
 @_action_has_layout=true,
 @_headers={"Content-Type"=>"text/html"},
 @_request=nil,
 @_response=nil,
 @_routes=nil,
 @_status=200>
[7] pry(main)> x.email
=> "a8d82b6be3f8fd74fb230ab9"

What is this hash-looking output? Shouldn't the job be triggered?


Solution

  • Ruby implicitly returns the value of the last expression. In your case it seems to be the id of the queued job.