Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

adding observer example

  • Loading branch information...
commit 9f3637fad5bb68b13a6d004694ba8d2b5e6b8d9d 1 parent 552f535
@frodsan frodsan authored
Showing with 10 additions and 0 deletions.
  1. +10 −0 activemodel/README.rdoc
View
10 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
Please sign in to comment.
Something went wrong with that request. Please try again.