From de4c9a1289e59c9c225bd425950709af8d48e0ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonne=20Ha=C3=9F?= Date: Tue, 31 Jan 2012 21:56:01 +0100 Subject: [PATCH] add warning about common setup error manifesting in uninitialized constant Oink --- config/initializers/oink.rb | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/config/initializers/oink.rb b/config/initializers/oink.rb index c8a17b0fb..038dd3c5c 100644 --- a/config/initializers/oink.rb +++ b/config/initializers/oink.rb @@ -1,3 +1,12 @@ if Rails.env == 'development' - Rails.application.middleware.use(Oink::Middleware, :logger => Rails.logger) -end \ No newline at end of file + if defined?(Oink) + Rails.application.middleware.use(Oink::Middleware, :logger => Rails.logger) + else + $stderr.puts "WARNING:" + $stderr.puts " You run in development but Oink isn't available in your gems." + $stderr.puts " That most likely means you copied the bundle command from the installation guide" + $sterrr.puts " and didn't removed development from the --without parameter while having" + $stderr.puts " the intention to run under development mode. To fix this either switch to" + $stderr.puts " production mode or do a rm .bundle/config and run bundle install --without heroku" + end +end