João Mateus João Mateus - 7 months ago 52
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.


You can use Rails.env



This will return boolean value true or false