Browse files

Improved ActiveModel Observing docs.

  • Loading branch information...
1 parent bf3a3c2 commit b84b759ec60b5005fea183186639408fcf903450 @smartinez87 smartinez87 committed Apr 30, 2011
Showing with 4 additions and 2 deletions.
  1. +4 −2 activemodel/lib/active_model/observing.rb
View
6 activemodel/lib/active_model/observing.rb
@@ -56,6 +56,8 @@ def instantiate_observers
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 @@ def notify_observers(method)
# 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

0 comments on commit b84b759

Please sign in to comment.