Hey Ezra,
Thanks, thats brilliant :)
Cheers
Tim
On 31 Dec 2007, at 00:12, Ezra Zygmuntowicz wrote:
> Hey Tim-
>
> There are a few ways of doing this. The best way it to use the
> Merb::Plugins.config hash. If you generate a fresh plugin:
>
> merb -P foobar
>
> Then look in the plugin at the lib/foobar.rb file you will see this:
>
> # make sure we're running inside Merb
> if defined?(Merb::Plugins)
>
> # Merb gives you a Merb::Plugins.config hash...feel free to put
> your stuff in your piece of it
> Merb::Plugins.config[:foobar] = {
> :chickens => false
> }
>
> Merb::Plugins.add_rakefiles "foobar/merbtasks"
> end
>
>
> So your best bet is to load the yaml file here and store it away in
> the Merb::Plugins.config hash.. Something like this:
>
>
> # Merb gives you a Merb::Plugins.config hash...feel free to put
> your stuff in your piece of it
> Merb::Plugins.config[:foobar] = Erubis.load_yaml_file(MERB_ROOT /
> 'config' / 'foobar.yml' )
>
>
> Then you can put your foobar.yml file inside of MERB_ROOT/config/
> And now in your app when you want to refer to the hash of stuff
> loaded from the yaml file you woudl access it like this:
>
> Merb::Plugins.config[:foobar][:somekey]
>
>
> Doing it will Erubis.load_yaml_file will load the yaml file and
> interpolate any erb tags inside of it before yaml loading it.
>
> Make sense?
>
> Cheers-
>
> - Ezra Zygmuntowicz
_______________________________________________
Merb-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/merb-devel