Skip to content

Commit

Permalink
Don't load config if environment variables not present. Fixes #1166. …
Browse files Browse the repository at this point in the history
…(Terence Lee)
  • Loading branch information
durran committed Dec 19, 2011
1 parent e3bdb5d commit d64cee6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/mongoid/railtie.rb
Expand Up @@ -59,7 +59,9 @@ def self.generator
#
initializer "setup database" do
config_file = Rails.root.join("config", "mongoid.yml")
if config_file.file?
# @todo: Durran: Remove extra check when #1291 complete.
if config_file.file? &&
YAML.load(ERB.new(File.read(config_file)).result)[Rails.env].values.flatten.any?
::Mongoid.load!(config_file)
end
end
Expand Down

0 comments on commit d64cee6

Please sign in to comment.