diff options
author | Sebastian Martinez <sebastian@wyeworks.com> | 2011-04-30 20:35:25 -0300 |
---|---|---|
committer | Sebastian Martinez <sebastian@wyeworks.com> | 2011-04-30 20:35:25 -0300 |
commit | b84b759ec60b5005fea183186639408fcf903450 (patch) | |
tree | 409f49ccc41a9339fad6284d545d0854c98e1dd0 /activemodel/lib/active_model | |
parent | bf3a3c22c06b7f2f38d0d53af7508d1b3a0aa341 (diff) | |
download | rails-b84b759ec60b5005fea183186639408fcf903450.tar.gz rails-b84b759ec60b5005fea183186639408fcf903450.tar.bz2 rails-b84b759ec60b5005fea183186639408fcf903450.zip |
Improved ActiveModel Observing docs.
Diffstat (limited to 'activemodel/lib/active_model')
-rw-r--r-- | activemodel/lib/active_model/observing.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/activemodel/lib/active_model/observing.rb b/activemodel/lib/active_model/observing.rb index c1ac4eb4af..cfe71074a5 100644 --- a/activemodel/lib/active_model/observing.rb +++ b/activemodel/lib/active_model/observing.rb @@ -56,6 +56,8 @@ module ActiveModel end # Add a new observer to the pool. + # The new observer needs to respond to 'update', otherwise it + # raises an +ArgumentError+ exception. def add_observer(observer) unless observer.respond_to? :update raise ArgumentError, "observer needs to respond to `update'" @@ -144,8 +146,8 @@ module ActiveModel # Observers will by default be mapped to the class with which they share a # name. So CommentObserver will be tied to observing Comment, ProductManagerObserver # to ProductManager, and so on. If you want to name your observer differently than - # the class you're interested in observing, you can use the Observer.observe class - # method which takes either the concrete class (Product) or a symbol for that + # the class you're interested in observing, you can use the <tt>Observer.observe</tt> + # class method which takes either the concrete class (Product) or a symbol for that # class (:product): # # class AuditObserver < ActiveModel::Observer |