开发者

How to know which rails environment is running in delayed job

I have a delayed job which is working perfectly fine. I want to know which environment is this. Is it production or development or staging. Check the code please. ENV["RAILS_ENV"] is nuil?

class SendMessageJob < Struct.n开发者_如何学Pythonew(:message_id)
  def perform
    p ENV["RAILS_ENV"] // printing nil :(
    p "hello world"

  end  
end  

I tried including

require "#{File.dirname(__FILE__)}/../config/environment.rb"

on the top the file still nothing..


You can try RAILS_ENV (constant defined within Rails) or the newer one Rails.env (a wrapper for this).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜