Hey, I'm a lurker that doesn't live in San Diego, but I thought I'd
throw in my thoughts.
Nathan Colgate Clark wrote:
> I'm working on making an app a little bit easier to replicate the
> same app for different clients. Does anybody know of a good way to
> make application-wide variables (global variables?). Right now I'm
> putting this in the bottom of my environments.rb file:
>
> ENV['BUSINESS_NAME'] = "Wilderness Enterprises"
> ENV['BUSINESS_ADDRESS'] = "123 Main"
You're inclination that this smells is a good one. I would leave ENV
alone for things that pertain to application logic only.
I generally create a Config class in lib/my_app/config.rb and use
that instead:
module MyApp
class Config
cattr_accessor :foo
end
end
Then in environment.rb:
MyApp::Config.foo = "bar"
This works really well when you don't need runtime configuration via
the database. For that I recommend the excellent config
table-to-hash paradigm John Long uses in Radiant:
http://lnk.nu/dev.radiantcms.org/ds5.rb
-Drew
_______________________________________________
Sdruby mailing list
[email protected]
http://lists.sdruby.com/mailman/listinfo/sdruby