Why does Rails debug information shows up in production?

I recently upgraded Bargain Stock Funds
(http://www.bargainstockfunds.com)
and Doppler Value Investing (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?

On Sep 11, 2013, at 11:25 AM, “Jason H., Rubyist”
[email protected] wrote:

I recently upgraded Bargain Stock Funds (http://www.bargainstockfunds.com) and
Doppler Value Investing (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’.

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.

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.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs