Display message when not running off the production database

Hi,

Is there a way to output a message to the top of every page when the
rails application is not running from the production database?

Thanks

On 7/5/06, ben [email protected] wrote:

Is there a way to output a message to the top of every page when the
rails application is not running from the production database?

Do you mean as an error message if the database crashes or as a way to
say “Hey, this is a staging box.”?

If it’s the former, I’m not sure since it would depend on how usable
your app really is if the database blows up.

If it’s the latter, you can get the current environment name from the
constant RAILS_ENV and compare it to whatever name you’re looking for
– probably “production”.

– James

On 5-Jul-06, at 12:21 PM, ben wrote:

Is there a way to output a message to the top of every page when the
rails application is not running from the production database?

Use the RAILS_ENV environment variable to determine what environment
you’re running in. In app/views/layouts/application.rhtml, something
like:

<%= ‘Not in production’ unless ENV[‘RAILS_ENV’] == ‘production’ %>

/Jeff

Jeffrey H. wrote:

On 5-Jul-06, at 12:21 PM, ben wrote:

Is there a way to output a message to the top of every page when the
rails application is not running from the production database?

Use the RAILS_ENV environment variable to determine what environment
you’re running in. In app/views/layouts/application.rhtml, something
like:

<%= ‘Not in production’ unless ENV[‘RAILS_ENV’] == ‘production’ %>

/Jeff

thanks, does a perfect job