1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Observers was extracted from Active Model as rails-observers gem

This commit is contained in:
Akira Matsuda 2013-01-02 06:23:12 +09:00
parent 3bf1267257
commit 7f495993bb

View file

@ -133,24 +133,6 @@ behavior out of the box:
{Learn more}[link:classes/ActiveModel/Naming.html]
* Observer support
ActiveModel::Observers allows your object to implement the Observer
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
ActiveModel::Serialization provides a standard interface for your object