João Mateus João Mateus - 1 year ago 101
Ruby Question

Conditional statement to check Rails environment

I have two environments on my rails app: development and production.

I would like to add a conditional statement to a specific controller to check which environment the app is running in order to behave differently.

How can I do this? many thanks in advance.

Answer Source

You can use Rails.env



This will return boolean value true or false

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download