Module: Mailboxer::Models::Messageable
- Defined in:
- app/models/messageable.rb
Overview
:nodoc:
Instance Method Summary collapse
- #attach_files(attachments, message) ⇒ Object
- #build_convo(subject, message_timestamp) ⇒ Object
- #build_message(convo, recipients, msg_body, subject, message_timestamp) ⇒ Object
- #connect_message_to_message_attachments ⇒ Object
- #send_message_mult_attach(recipients, msg_body, subject, sanitize_text = true, attachments = nil, message_timestamp = Time.now) ⇒ Object
Instance Method Details
#attach_files(attachments, message) ⇒ Object
44 45 46 47 48 49 |
# File 'app/models/messageable.rb', line 44 def attach_files(, ) return unless .present? .each do |m| . << MessageAttachment.new(file: m[:file]) end end |
#build_convo(subject, message_timestamp) ⇒ Object
17 18 19 20 21 22 23 |
# File 'app/models/messageable.rb', line 17 def build_convo(subject, ) ::Mailboxer::ConversationBuilder.new( subject: subject, created_at: , updated_at: ).build end |
#build_message(convo, recipients, msg_body, subject, message_timestamp) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 |
# File 'app/models/messageable.rb', line 25 def (convo, recipients, msg_body, subject, ) ::Mailboxer::MessageBuilder.new( sender: self, conversation: convo, recipients: recipients, body: msg_body, subject: subject, created_at: , updated_at: ).build end |
#connect_message_to_message_attachments ⇒ Object
37 38 39 40 41 42 |
# File 'app/models/messageable.rb', line 37 def Mailboxer::Message.class_eval do has_many :message_attachments attr_accessible :message_attachments end end |
#send_message_mult_attach(recipients, msg_body, subject, sanitize_text = true, attachments = nil, message_timestamp = Time.now) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'app/models/messageable.rb', line 4 def (recipients, msg_body, subject, sanitize_text = true, = nil, = Time.now) convo = build_convo(subject, ) = (convo, recipients, msg_body, subject, ) attach_files(, ) .deliver false, sanitize_text end |