How to run certain lines of code in only production or development mode in Ruby on Rails

Posted on 12 April 2008

Often I don't want to fire off emails to the site admin when I'm testing things on my local machine.

That's when the following comes in really handy...

ENV['RAILS_ENV'] == "production"

About Paul

Paul works for Kyan web design agency in Surrey, UK as a Ruby on Rails developer.

Follow Paul on Twitter

Email: paulsturgess [at] gmail.com

Read more articles in the archive →

Got something to say?