# Why does Rails debug information shows up in production?

**URL:** <https://www.ruby-forum.com/t/why-does-rails-debug-information-shows-up-in-production/236532>\
**Category:** Rails\
**Created:** [September 11, 2013, 6:27pm UTC](https://www.ruby-forum.com/t/why-does-rails-debug-information-shows-up-in-production/236532 "2013-09-11T18:27:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![addis\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c4cdca/32.png) [@addis\_a](https://www.ruby-forum.com/u/addis_a)\
**Post date:** [September 11, 2013, 6:27pm UTC](https://www.ruby-forum.com/t/why-does-rails-debug-information-shows-up-in-production/236532/1 "2013-09-11T18:27:06Z")

</div>

I recently upgraded Bargain Stock Funds  
([http://www.bargainstockfunds.com](http://www.bargainstockfunds.com))  
and Doppler Value Investing ([http://www.dopplervalueinvesting.com](http://www.dopplervalueinvesting.com)) from  
Rails 3.2 to Rails 4.0.

I’ve noticed that the debug information is on the production web site  
even  
though the app/views/layouts/application.html.erb file has the line “\<%=  
debug(params) if Rails.env.development? %\>”. This SHOULD suppress the  
debug information on each page in the production environment, but it  
doesn’t seem to be working. (The technical tabs on both web sites  
contain  
the links to the source code.)

Commenting out the “\<%= debug(params) if Rails.env.development? %\>” line  
does remove the debug information, but I need to retain it in the  
development environment. Thus, I believe that my production environment  
is  
being mistaken for the development environment.

My questions:

1. How do I confirm whether I’m in the development or production  
environment? My assumptions don’t seem to be holding up.
2. What is the mechanism that specifies the development or production  
environment?

---

<div class="post-metadata">

**Author:** ![Jason\_H.S\_Rubyist](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/2bfe46/32.png) [@Jason\_H.S\_Rubyist](https://www.ruby-forum.com/u/Jason_H.S_Rubyist)\
**Post date:** [September 11, 2013, 6:32pm UTC](https://www.ruby-forum.com/t/why-does-rails-debug-information-shows-up-in-production/236532/2 "2013-09-11T18:32:22Z")

</div>

On Sep 11, 2013, at 11:25 AM, “Jason H., Rubyist”  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I recently upgraded Bargain Stock Funds ([http://www.bargainstockfunds.com](http://www.bargainstockfunds.com)) and  
> Doppler Value Investing ([http://www.dopplervalueinvesting.com](http://www.dopplervalueinvesting.com)) from Rails 3.2 to  
> Rails 4.0.
> 
> I’ve noticed that the debug information is on the production web site even  
> though the app/views/layouts/application.html.erb file has the line “\<%=  
> debug(params) if Rails.env.development? %\>”. This SHOULD suppress the debug  
> information on each page in the production environment, but it doesn’t seem to be  
> working. (The technical tabs on both web sites contain the links to the source  
> code.)

This tells me you are not running with RAILS\_ENV=‘production’. Instead,  
it is either not set (defaults to ‘development’) or is set to  
‘development’.

> Commenting out the “\<%= debug(params) if Rails.env.development? %\>” line does  
> remove the debug information, but I need to retain it in the development  
> environment. Thus, I believe that my production environment is being mistaken for  
> the development environment.
> 
> My questions:
> 
> 1. How do I confirm whether I’m in the development or production environment?  
> My assumptions don’t seem to be holding up.

You check Rails.env or ENV[‘RAILS\_ENV’]

> 1. What is the mechanism that specifies the development or production  
> environment?

The RAILS\_ENV environment variable is set to the environment you want  
loaded. If it is not set or empty, it defaults to ‘development’.

---

<div class="post-metadata">

**Author:** ![Jason\_H.S\_Rubyist](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/2bfe46/32.png) [@Jason\_H.S\_Rubyist](https://www.ruby-forum.com/u/Jason_H.S_Rubyist)\
**Post date:** [September 11, 2013, 6:44pm UTC](https://www.ruby-forum.com/t/why-does-rails-debug-information-shows-up-in-production/236532/3 "2013-09-11T18:44:38Z")

</div>

I’ve done some troubleshooting and have confirmed that what should be my  
production environment is being seen by Rails as the development  
environment instead.

What is the proper way to make sure that my production environment is  
actually seen by Rails as the production environment? Please keep in  
mind  
that I’m in Rails 4.0 and not 3.2 now.

---

<div class="post-metadata">

**Author:** ![Jason\_H.S\_Rubyist](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/2bfe46/32.png) [@Jason\_H.S\_Rubyist](https://www.ruby-forum.com/u/Jason_H.S_Rubyist)\
**Post date:** [September 12, 2013, 7:34am UTC](https://www.ruby-forum.com/t/why-does-rails-debug-information-shows-up-in-production/236532/4 "2013-09-12T07:34:43Z")

</div>

I found out what the problem was. The nginx.conf file in the production  
environment (which is automatically generated when I create the Rails  
4.0  
app in WebFaction) specified the development environment instead. I  
changed it to specify the production environment. Now the production  
environment actually behaves like the production environment.
