I'm trying to do the relation:
has_many :notifications, foreign_key: :notified_object_id, conditions: {notified_object_type: 'AppShare'}, dependent: :destroy
found on this page: http://blog.meldium.com/home/2013/4/22/dont-spam-your-users-batch-notifications-in-rails
I have changed it to:
has_many :notifications, -> { where( notified_object_type: 'Assigment') }, foreign_key: "notified_object_id", dependent: :destroy
Because of the rails 4 syntax, but i'm getting this:
uninitialized constant Assigment::Notification
can someone help me out here?
Thanks
For those who are seeing similar error, I had to add class_name: "Mailboxer::Notification"
to that has_many
relation.
has_many :notifications, -> { where( notified_object_type: 'Assignment') },
foreign_key: "notified_object_id", dependent: :destroy,
class_name: "Mailboxer::Notification"