Skip to content

Instantly share code, notes, and snippets.

@hone
Created August 19, 2011 23:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hone/3a15d6b13aa404dbb41d to your computer and use it in GitHub Desktop.
Save hone/3a15d6b13aa404dbb41d to your computer and use it in GitHub Desktop.
$ git diff
diff --git a/lib/mongoid/railtie.rb b/lib/mongoid/railtie.rb
index 1a2cf40..d8132b0 100644
--- a/lib/mongoid/railtie.rb
+++ b/lib/mongoid/railtie.rb
@@ -60,7 +60,11 @@ module Rails #:nodoc:
initializer "setup database" do
config_file = Rails.root.join("config", "mongoid.yml")
if config_file.file?
- ::Mongoid.load!(config_file)
+ begin
+ ::Mongoid.load!(config_file)
+ rescue Mongo::ConnectionFailure => e
+ $stderr.puts "\n#{e.message}"
+ end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment