
Untitled
By: a guest on
Aug 11th, 2012 | syntax:
None | size: 0.64 KB | hits: 6 | expires: Never
Mongoid Polymorphic Association suddenly not working on Heroku / MongoHQ
Notification.create(
type: "new_comment",
recipient: recipient,
actor: self.user,
subject: self,
secondary_subject: self.post)
Notification.create(
type: "new_comment",
recipient_id: recipient.id,
recipient_type: recipient.class.to_s,
actor_id: self.user.id,
actor_type: self.user.class.to_s,
subject: self,
secondary_subject: self.post)
class Notification
belongs_to :recipient, class_name: "User", index: true
belongs_to :actor, class_name: "User", index: true
end
class User
has_many :notifications, as: :recipient
end