Rails - How do I check developer mode or production mode in code

前端 未结 1 1801
梦谈多话
梦谈多话 2021-01-31 07:17

I am doing a project in rails, I would like to know How do I check whether I am running in developer mode or production mode in code ?

Thanks

1条回答
  •  佛祖请我去吃肉
    2021-01-31 08:21

    Rails.env == "production"
    
    Rails.env == "development"
    

    As mentioned by @xoebus, this is far better:

    Rails.env.production?
    
    Rails.env.development?
    

    0 讨论(0)
提交回复
热议问题