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:
parent
3bf1267257
commit
7f495993bb
1 changed files with 0 additions and 18 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue