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

Ruby on-RailsRubyRuby on-Rails-3

Ruby on-Rails Problem Overview


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

Ruby on-Rails Solutions


Solution 1 - Ruby on-Rails

Rails.env == "production"

Rails.env == "development"

As mentioned by @xoebus, this is far better:

Rails.env.production?

Rails.env.development?

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionSreerajView Question on Stackoverflow
Solution 1 - Ruby on-RailsapneadivingView Answer on Stackoverflow