[Rails] Configuration values

Dave Thomas Dave at PragProg.com
Wed Jan 5 05:35:46 GMT 2005


On Jan 4, 2005, at 9:05 PM, Demetrius Nunes wrote:

> You can use a "cache pattern" to address this, like in:
>
> def app_config
>    return @app_config if @app_config
>    @app_config = YAML.load(...)
>    @app_config
> end
>

I like

   def app_config
     @app_config ||= YAML.load(...)
   end


Cheers

Dave



More information about the Rails mailing list