app/models/message_train/receipt.rb in message_train-0.5.3 vs app/models/message_train/receipt.rb in message_train-0.6.0
- old
+ new
@@ -1,10 +1,14 @@
module MessageTrain
# Receipt model
class Receipt < ActiveRecord::Base
belongs_to :recipient, polymorphic: true
belongs_to :received_through, polymorphic: true
- belongs_to :message, foreign_key: :message_train_message_id
+ belongs_to(
+ :message,
+ foreign_key: :message_train_message_id,
+ touch: true
+ )
validates_presence_of :recipient, :message
default_scope { order(updated_at: :desc) }
scope :sender_receipt, -> { where(sender: true) }
scope :recipient_receipt, -> { where(sender: false) }