Created
April 10, 2011 19:50
-
-
Save jacquescrocker/912656 to your computer and use it in GitHub Desktop.
configures padrino to use config/mongoid.yml
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
# config/database.rb | |
config_file = Padrino.root("config", "mongoid.yml") | |
if File.exists?(config_file) | |
settings = YAML.load(ERB.new(File.read(config_file)).result)[Padrino.env.to_s] | |
::Mongoid.from_hash(settings) if settings.present? | |
end |
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
# config/mongoid.yml | |
options: &options | |
parameterize_keys: false | |
defaults: &defaults | |
host: localhost | |
# slaves: | |
# - host: slave1.local | |
# port: 27018 | |
# - host: slave2.local | |
# port: 27019 | |
development: | |
<<: *defaults | |
<<: *options | |
database: tweetup_dev | |
test: | |
<<: *defaults | |
<<: *options | |
database: tweetup_test | |
production: | |
<<: *options | |
uri: <%= ENV['MONGOHQ_URL'] %> | |
database: tweetup |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
or just remove database.rb and put
Mongoid.load!("config/mongoid.yml")
at boot.rb