aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/README.rdoc
diff options
context:
space:
mode:
Diffstat (limited to 'activemodel/README.rdoc')
-rw-r--r--activemodel/README.rdoc10
1 files changed, 10 insertions, 0 deletions
diff --git a/activemodel/README.rdoc b/activemodel/README.rdoc
index 1fd75141f8..0c7089598c 100644
--- a/activemodel/README.rdoc
+++ b/activemodel/README.rdoc
@@ -135,6 +135,16 @@ behavior out of the box:
pattern in a Rails App and take advantage of all the standard observer
functions.
+ class PersonObserver < ActiveModel::Observer
+ def after_create(person)
+ person.logger.info("New person added!")
+ end
+
+ def after_destroy(person)
+ person.logger.warn("Person with an id of #{person.id} was destroyed!")
+ end
+ end
+
{Learn more}[link:classes/ActiveModel/Observer.html]
* Making objects serializable