I have around 40 models in my RoR application. I want to setup a after_save callback for all models. One way is to add it to all models. Since this callback has the same cod
Based on @harish's answer and in this answer (https://stackoverflow.com/a/10712838/2226338):
class AuditObserver < ActiveRecord::Observer Rails.application.eager_load! observe ActiveRecord::Base.descendants def after_save(record) ... end end