Class: MessageThread
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- MessageThread
- Defined in:
- app/models/message_thread.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.for(message, user) ⇒ Object
17 18 19 |
# File 'app/models/message_thread.rb', line 17 def self.for(, user) where(:parent_message_id => (.parent_id || .id), :recipient_id => user.id).first end |
Instance Method Details
#creator_name ⇒ Object
13 14 15 |
# File 'app/models/message_thread.rb', line 13 def creator_name .sender.eql?(recipient) ? 'Me' : .sender.login end |
#mark_messages_deleted ⇒ Object
21 22 23 24 25 26 |
# File 'app/models/message_thread.rb', line 21 def .mark_deleted(recipient) .children.each do |child| child.mark_deleted(recipient) end end |
#read? ⇒ Boolean
28 29 30 |
# File 'app/models/message_thread.rb', line 28 def read? .recipient.eql?(recipient) ? .read? : 'read' end |
#subject ⇒ Object
9 10 11 |
# File 'app/models/message_thread.rb', line 9 def subject .subject end |