I have the following code in environment.rb:
require File.join(File.dirname(FILE), ‘boot’)
raw_config = File.read(RAILS_ROOT + “/config/config.yml”)
APP_CONFIG = YAML.load(raw_config)[RAILS_ENV]
This works fine when running the server, but if I try and start a
console I get:
Loading development environment.
./script/…/config/…/config/environment.rb:15:NameError:
uninitialized constant YAML
Can anyone help me out? Thanks.
Chris
On 15 Apr 2008, at 18:10, Chris S wrote:
Loading development environment.
./script/…/config/…/config/environment.rb:15:NameError:
uninitialized constant YAML
Can anyone help me out? Thanks.
You probably need a require ‘yaml’ before you use yaml. I’m guess that
when you run the server, the server itself loads yaml for its own
purposes before doing the railsy stuff and so you get lucky.
Fred
That did the trick, thanks Fred.
On Apr 15, 12:36 pm, Frederick C. [email protected]