[Rails] Configuration values
Eric Hodel
drbrain at segment7.net
Wed Jan 5 19:52:03 GMT 2005
On 04 Jan 2005, at 17:35, Marcel Molina Jr. wrote:
> And in your config/environments/development.rb you had:
>
> def app_configurations
> YAML.load(File.open(RAILS_ROOT + '/config/development.yml'))
> end
This leaves an open file every time you call app_configurations.
> APP_CONFIG = YAML.load(File.open(RAILS_ROOT +
> '/config/development.yml'))
A little better, only one open file.
You need to use the block form of File.open to ensure that open files
are closed properly.
File.open "#{RAILS_ROOT}/config/development.yml" do |fp|
APP_CONFIG = YAML.load fp
end
--
Eric Hodel - drbrain at segment7.net - http://segment7.net
FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
Url : http://one.textdrive.com/pipermail/rails/attachments/20050105/3b62839b/PGP.bin
More information about the Rails
mailing list