Skip to content


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
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
+ class PersonObserver < ActiveModel::Observer
+ def after_create(person)
+"New person added!")
+ end
+ def after_destroy(person)
+ person.logger.warn("Person with an id of #{} 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.