On Sat, Jun 28, 2008 at 8:08 AM, Antony Evans <[EMAIL PROTECTED]> wrote:
>
> Thanks Michael, sounds like passwords.yml file is the right way to
> go.  Couple of questions:
> 1.  How do I make sure that the file gets loaded when the application
> boots.

See if you can adapt the code at
http://snippets.dzone.com/posts/show/287 (found by Googling "rails
loading custom yaml").  Here's what it looks like in the console:

>> @config = YAML::load(File.open("#{RAILS_ROOT}/config/database.yml"))
=> {"development"=>{"username"=>"root", "adapter"=>"mysql",
"timeout"=>5000, "password"=>nil, "database"=>"insoshi"},
"production"=>{"username"=>"root", "adapter"=>"mysql",
"timeout"=>5000, "password"=>nil, "database"=>"insoshi_production"},
"test"=>{"adapter"=>"sqlite3", "timeout"=>5000,
"database"=>"db/test.sqlite3"}}
=> {"username"=>"root", "adapter"=>"mysql", "timeout"=>5000,
"password"=>nil, "database"=>"insoshi"}
>> @config["development"]["adapter"]
=> "mysql"

> 2.  How do I tell git to ignore the file and not include in the
> source?

Add a line to .gitignore in the project root directory with the name
of your config file.  Follow the model for database.yml:

$ grep yml .gitignore
config/database.yml

--~--~---------~--~----~------------~-------~--~----~
Insoshi developer site: http://dogfood.insoshi.com/
Insoshi documentation: http://docs.insoshi.com/

You received this message because you are subscribed to the Google
Groups "Insoshi" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/insoshi?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to