[Rails] Configuration values
Demetrius Nunes
demetrius at interface-ti.com.br
Thu Jan 6 00:38:32 GMT 2005
Dave Thomas wrote:
> 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
Much better!! I gotta get more fluent in this Ruby "slang"! ;-)
More information about the Rails
mailing list