app/models/message.rb
# Return true if the sender/recipient pair is valid for a given parent.
Return true if the sender/recipient pair is valid for a given parent.
Return true if the sender / recipient pair is valid for a given parent .
def correct_sender_recipient_pair?
    Set.new([sender, recipient]) == Set.new([parent.sender, parent.recipient])
  end
def correct_sender_recipient_pair? Set . new ( [ sender , recipient ] ) == Set . new ( [ parent . sender , parent . recipient ] ) end
Return true if the sender/recipient pair is valid for a given parent.
Return true if the sender / recipient pair is valid for a given parent .
# People can send multiple replies to the same message, in which case # the recipient is the same as the parent recipient. # For most replies, the message recipient should be the parent sender. # We use Set to handle both cases uniformly.