[Sdruby] Application Wide Variables
Nathan Colgate Clark
nathancolgate at gmail.com
Tue Feb 27 23:22:33 GMT 2007
Thanks, Stephen. This works great, and it does look "pretty". Here are
my views now:
<%=h Company::Name %>
That is just what I wanted.
-Nathan
Stephen Waits wrote:
> Kevin Clark wrote:
>> $blah is a global variable.
>
> Which might be ok for just a few things.. If you want to pretty it
> up, you might consider creating a Module with constants (assuming
> these are in fact constant, which it sounds like they are in your
> case). Something like this:
>
> module AppParameters
> SiteOwner = "Sam Spade"
> ...
> end
>
> Then, throw that into a file (maybe under lib), require it app wide
> (environment.rb), and access your constants everywhere..
>
> <%= AppParameters::SiteOwner %>
>
> etc..
>
> One thing though... I haven't actually tested this. :)
>
> --Steve
>
>
> _______________________________________________
> Sdruby mailing list
> Sdruby at lists.sdruby.com
> http://lists.sdruby.com/mailman/listinfo/sdruby
>
More information about the Sdruby
mailing list