aboutsummaryrefslogtreecommitdiffstats
path: root/railties/doc/guides/source/activerecord_validations_callbacks.txt
diff options
context:
space:
mode:
authorCassioMarques <cassiommc@gmail.com>2008-12-13 22:09:39 -0200
committerCassioMarques <cassiommc@gmail.com>2008-12-13 22:09:39 -0200
commit539fafc30cd9db96c5c04f7bdaf26e612be5051d (patch)
treef82b8d06169c4756e9800999a3bac1d67eaddfe8 /railties/doc/guides/source/activerecord_validations_callbacks.txt
parentf06ea062975ee36f65c1a94650965c75ab706211 (diff)
downloadrails-539fafc30cd9db96c5c04f7bdaf26e612be5051d.tar.gz
rails-539fafc30cd9db96c5c04f7bdaf26e612be5051d.tar.bz2
rails-539fafc30cd9db96c5c04f7bdaf26e612be5051d.zip
Added some text about the possibility of observers' registration also at the config/environment files (AR Validations and Callbacks Guide)
Diffstat (limited to 'railties/doc/guides/source/activerecord_validations_callbacks.txt')
-rw-r--r--railties/doc/guides/source/activerecord_validations_callbacks.txt6
1 files changed, 5 insertions, 1 deletions
diff --git a/railties/doc/guides/source/activerecord_validations_callbacks.txt b/railties/doc/guides/source/activerecord_validations_callbacks.txt
index 9994d7adf3..e0bb534d0b 100644
--- a/railties/doc/guides/source/activerecord_validations_callbacks.txt
+++ b/railties/doc/guides/source/activerecord_validations_callbacks.txt
@@ -688,7 +688,7 @@ end
=== Registering observers
-If you payed attention, you may be wondering where Active Record Observers are referenced in our applications, so they get instantiate and begin to interact with our models. For observers to work we need to register then in our application's *config/environment.rb* file. In this file there is a commented out line where we can define the observers that our application should load at start-up.
+If you payed attention, you may be wondering where Active Record Observers are referenced in our applications, so they get instantiate and begin to interact with our models. For observers to work we need to register them somewhere. The usual place to do that is in our application's *config/environment.rb* file. In this file there is a commented out line where we can define the observers that our application should load at start-up.
[source, ruby]
------------------------------------------------------------------
@@ -696,6 +696,10 @@ If you payed attention, you may be wondering where Active Record Observers are r
config.active_record.observers = :registration_observer, :auditor
------------------------------------------------------------------
+You can uncomment the line with +config.active_record.observers+ and change the symbols for the name of the observers that should be registered.
+
+It's also possible to register callbacks in any of the files living at *config/environments/*, if you want an observer to work only in a specific environment. There is not a +config.active_record.observers+ line at any of those files, but you can simply add it.
+
=== Where to put the observers' source files
By convention, you should always save your observers' source files inside *app/models*.