Configuration Documentation


#1

Hi,

Where can I get the documentation/list of options for Rails
configuration?

The default environment.rb file references some default observers,
caching
options, etc… But I can’t find doco.

I do see this line:

See Rails::Configuration for more options

Where would that be?

Thanks,
Hunter


#2

It’s talking about the Configuration class in the Rails module, which
is defined in
/usr/lib/ruby/gems/1.8/gems/rails-0.14.3/lib/initializer.rb


#3

Great, thanks.

One line in the default environment.rb that I was curious about:

Activate observers that should always be running

config.active_record.observers = :cacher, :garbage_collector

This line makes it sound important but it is commented out. Where can I
learn about what these are and how they function?

Thanks,
Hunter


#4

On 6-dec-2005, at 1:01, Hunter H. wrote:

Great, thanks.

One line in the default environment.rb that I was curious about:

Activate observers that should always be running

config.active_record.observers = :cacher, :garbage_collector

This line makes it sound important but it is commented out. Where
can I
learn about what these are and how they function?

Read on ActiveRecord::Observer for the documentation. Moreover,
CacheSweepers are also observers.

Observers are singletons that “watch” your ActiveRecords and fire
when active records are modified (basically, they are standalone
callback containers, so to speak). An observer can be asked to watch
a particular set of models, and a method on the observer is called
for every AR callback.

The configuration is there because the observer needs to be
instantiated explicitly after defining them, as in

ChangeNotifier.instance

or hooked into the controller via the
observers :change_notifier, :html_cleaner line.

Observers are super-cool, for instance if you want to send e-mails
everytime a comment is posted to something etc.


Julian ‘Julik’ Tarkhanov
me at julik.nl