Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 11th, 2012  |  syntax: None  |  size: 0.64 KB  |  hits: 6  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Mongoid Polymorphic Association suddenly not working on Heroku / MongoHQ
  2. Notification.create(
  3.   type: "new_comment",
  4.   recipient: recipient,
  5.   actor: self.user,
  6.   subject: self,
  7.   secondary_subject: self.post)
  8.        
  9. Notification.create(
  10.   type: "new_comment",
  11.   recipient_id: recipient.id,
  12.   recipient_type: recipient.class.to_s,
  13.   actor_id: self.user.id,
  14.   actor_type: self.user.class.to_s,
  15.   subject: self,
  16.   secondary_subject: self.post)
  17.        
  18. class Notification
  19.   belongs_to :recipient, class_name: "User", index: true
  20.   belongs_to :actor,     class_name: "User", index: true
  21. end
  22.  
  23. class User
  24.   has_many :notifications, as: :recipient
  25. end