diff options
author | Jon Leighton <j@jonathanleighton.com> | 2010-10-31 10:04:56 +0000 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2010-10-31 10:04:56 +0000 |
commit | d010fb13ef622bdb781e3134005fc849db4c9bea (patch) | |
tree | 8ca8beb957fb51923938c4e7befa35d44e711dba /railties/guides/source/active_record_validations_callbacks.textile | |
parent | fc276e5635821e65c04b8961170cc6bd3c11b923 (diff) | |
parent | 3cf85fb4fcdae65a4d5a1a5c418492ea0cf9ad6d (diff) | |
download | rails-d010fb13ef622bdb781e3134005fc849db4c9bea.tar.gz rails-d010fb13ef622bdb781e3134005fc849db4c9bea.tar.bz2 rails-d010fb13ef622bdb781e3134005fc849db4c9bea.zip |
Merge branch 'master' into nested_has_many_through
Conflicts:
activerecord/lib/active_record/associations/has_many_association.rb
activerecord/lib/active_record/associations/through_association_scope.rb
Diffstat (limited to 'railties/guides/source/active_record_validations_callbacks.textile')
-rw-r--r-- | railties/guides/source/active_record_validations_callbacks.textile | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/railties/guides/source/active_record_validations_callbacks.textile b/railties/guides/source/active_record_validations_callbacks.textile index a9d66c0a06..e9ff6197ec 100644 --- a/railties/guides/source/active_record_validations_callbacks.textile +++ b/railties/guides/source/active_record_validations_callbacks.textile @@ -1128,14 +1128,14 @@ As with callback classes, the observer's methods receive the observed model as a h4. Registering Observers -Observers are conventionally placed inside of your +app/models+ directory and registered in your application's +config/environment.rb+ file. For example, the +UserObserver+ above would be saved as +app/models/user_observer.rb+ and registered in +config/environment.rb+ this way: +Observers are conventionally placed inside of your +app/models+ directory and registered in your application's +config/application.rb+ file. For example, the +UserObserver+ above would be saved as +app/models/user_observer.rb+ and registered in +config/application.rb+ this way: <ruby> # Activate observers that should always be running config.active_record.observers = :user_observer </ruby> -As usual, settings in +config/environments+ take precedence over those in +config/environment.rb+. So, if you prefer that an observer doesn't run in all environments, you can simply register it in a specific environment instead. +As usual, settings in +config/environments+ take precedence over those in +config/application.rb+. So, if you prefer that an observer doesn't run in all environments, you can simply register it in a specific environment instead. h4. Sharing Observers @@ -1151,7 +1151,7 @@ class MailerObserver < ActiveRecord::Observer end </ruby> -In this example, the +after_create+ method would be called whenever a +Registration+ or +User+ was created. Note that this new +MailerObserver+ would also need to be registered in +config/environment.rb+ in order to take effect. +In this example, the +after_create+ method would be called whenever a +Registration+ or +User+ was created. Note that this new +MailerObserver+ would also need to be registered in +config/application.rb+ in order to take effect. <ruby> # Activate observers that should always be running |