ben
2006-Jul-05 16:21 UTC
[Rails] 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 -- Posted via http://www.ruby-forum.com/.
James Ludlow
2006-Jul-05 17:01 UTC
[Rails] display message when not running off the production database
On 7/5/06, ben <ben@streamd.com> 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
Jeffrey Hardy
2006-Jul-05 17:07 UTC
[Rails] display message when not running off the production database
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
ben
2006-Jul-06 08:20 UTC
[Rails] Re: display message when not running off the production data
Jeffrey Hardy 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'' %> > > /Jeffthanks, does a perfect job -- Posted via http://www.ruby-forum.com/.