我正在尝试建立关系:
has_many :notifications, foreign_key: :notified_object_id, conditions: {notified_object_type: 'AppShare'}, dependent: :destroy
在此页面上找到:http: //blog.meldium.com/home/2013/4/22/dont-spam-your-users-batch-notifications-in-rails
我已将其更改为:
has_many :notifications, -> { where( notified_object_type: 'Assigment') }, foreign_key: "notified_object_id", dependent: :destroy
由于 rails 4 语法,但我得到了这个:
未初始化的常量 Assigment::Notification
有人可以帮我吗?
谢谢