On Wed, 2006-03-15 at 01:20 -0500, Dorian M. wrote:
CompanyPhoneNo = “(602) 999-9999”
and be able to use it in any view with any controller, how do I do that?
you know…this is one of the things that sort of sucks about
rails…that which should be ridiculously simple is poorly documented
and difficult to accomplish…
that pages says…
Just another ruby file
Place your configuration constants in a regular Ruby file. include the
file where you need the settings. For example, this is my
config/email.conf.rb
Email configuration
$SMTP_ADDRESS = “smtp.mac.com”
$SMTP_PORT = 25
$SMTP_DOMAIN = “mail.mac.com”
$SMTP_USER_NAME = “johnatl”
$SMTP_USER_PASSWORD = “secret”
so I made a file… config/defaults.rb
In the controller section, I try…
:include ../config/defaults.rb
SyntaxError in #
./script/…/config/…/app/controllers/reports_controller.rb:21: unknown
regexp options - dfalt
:include "../config/defaults.rb"
SyntaxError in #
./script/…/config/…/app/controllers/reports_controller.rb:21: syntax
error, unexpected tSTRING_BEG, expecting kEND
:include “…/config/defaults.rb”
:include => "../config/defaults.rb"
SyntaxError in #
./script/…/config/…/app/controllers/reports_controller.rb:21: syntax
error, unexpected tASSOC, expecting kEND
:include => “…/config/defaults.rb”
include "../config/defaults.rb"
NoMethodError in Reports#rfn2
undefined method `include’ for #ReportsController:0xb7d003d4
so that means in order to get a few stupid default values, I have to
create a table and keep hitting the table all the time.
Craig