[Rails] Declaring ActiveRecord observers

Juan Lupión pantulis at gmail.com
Sat Mar 4 16:07:03 GMT 2006


Hello

I'm using the 'act_as_authenticated' plugin to implement a small and
simple authentication system in my app.  Everything is working just
fine and the world is a better place to live in.  The plugin creates a
ActiveRecord observer in order to send the newly registered user a
confirmation e-mail.

Per the API docs [1], one should declare the observer in the
config/environment.rb file under the 'config.active_record.observers =
:comment_observer, :signup_observer'.

But reading the generated source code, the plugin author recommends
declaring the observer in my ApplicationController with a 'observer
:user_observer' clause.

The observer gets triggered in both cases, but I am curious about this,

So, what is the "Rails way" of activating observers?


1. http://rubyonrails.org/api/classes/ActiveRecord/Observer.html

--
----------------------------------------------------
http://www.sobrerailes.com


More information about the Rails mailing list