Robert,

Another high quality response, thank you.

Let me respond briefly, selectively to your reply...

> - The parameters x, y & z will be initialized to known values.
> - The values of x, y & z are normally fixed, but can be altered by users
> (administrators) at runtime.

Yes, very infrequently, e.g., once a year, parameters used as
constants in application computations will change and will need to be
changed by an administrator. So, these parameters are global.

> 1. Use a configuration file to store key/value pairs <...> Use a
> configuration file (YAML). If the administrator needs to change the
> configuration then just update the file with the new parameter. You will
> also like want to cache these values in some form of memory cache so you
> don't have to read the values from disk/database on every request. Take
> a look at memcached.

I agree with you that this is likely the best approach for my
situation.

Borrowing from http://railsforum.com/viewtopic.php?id=15295, I might
read/write to my file via the following mechanism:

a_config = YAML.load_file "#{RAILS_ROOT}/config/application.yml"
a_config["user"]["pwd_days"] = params[:days]
File.open("#{RAILS_ROOT}/config/application.yml", 'w') { |f|
YAML.dump(a_config, f) }

Look good?

Two final questions for you:

1. Regarding the use of memcached for efficiency, it is a efficiency
option available for flat file and database persisted data, alike,
right? So, I might look forward to its use in varied manner of
performance tuning?

2. > In all of these cases you could use seeds.rb to initialize your
values.

So, seeds is kind of like providing a user with a place to start,
e.g., standardized settings, that they may then wish to change? It is
not really for classic configuration, i.e., it does not involve global
settings.

Grar

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to