-
-
Save hone/04a8aea95f7b6adce6c6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/mongoid/railtie.rb b/lib/mongoid/railtie.rb | |
index 1a2cf40..dbbd26f 100644 | |
--- a/lib/mongoid/railtie.rb | |
+++ b/lib/mongoid/railtie.rb | |
@@ -59,7 +59,8 @@ module Rails #:nodoc: | |
# | |
initializer "setup database" do | |
config_file = Rails.root.join("config", "mongoid.yml") | |
- if config_file.file? | |
+ if config_file.file? && | |
+ YAML.load(ERB.new(File.read(config_file)).result)[Rails.env].values.flatten.any? | |
::Mongoid.load!(config_file) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment