Skip to content

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"

View the snippets archive ››

No comments have been left

Got something to say?

About

Paul is a web developer for Kyanmedia web agency. He's lucky enough to write in Ruby on Rails full-time and uses this site to post snippets of code.

Contact

my name at gmail.com

More snippets

Take a look in the archive

Need a website?

Contact my employer. Make sure to check out our portfolio of work.

Hosting

I recommend hostingrails.com