The observer class name can be any name. What really matters is this line
observe :post_action, :topic, :post, :notification, :topic_user
which observes objects created under PostAction, Topic, Post, Notification and TopicUser
The after_save
is called after creating and updating a record. The passed argument is the actual object involved so it can be an instance of any of the 5 observed model. Using model
as the parameter name is a bit misleading so you should change that to something like record
UPDATE: from the api
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 class (:product)