Observers in Rails Engines
问题 I'm trying to create an observer in my Rails engine that will observe a model in my main application. My observer (in app/models/my_engine/my_observer.rb) is, module MyEngine class MyObserver < ActiveRecord::Observer observe AppModel def after_create # code to run when callback is observed end end end In order to register the observer, I've modified my engine (in lib/my_engine/engine.rb) to be, module MyEngine class Engine < ::Rails::Engine isolate_namespace MyEngine config.active_record