Using an observer within an Engine

前端 未结 1 867
感情败类
感情败类 2021-01-24 03:15

I\'ve created an Engine which is basically used for all of our projects.

Now what I want to do is add a before_create callback to all of the models in this

相关标签:
1条回答
  • 2021-01-24 03:54

    In engines, instead of application.rb you should use lib/[engine_name]/engine.rb

    Also, if you create observer inside an engine, you need to namespace it.

    0 讨论(0)
提交回复
热议问题