Sha256: 65895cd6fb534b5fb34e65043f705a627c32595af8edd1b52a89d3b3cab6c69f

Contents?: true

Size: 755 Bytes

Versions: 1

Compression:

Stored size: 755 Bytes

Contents

module Messaging
  class Message
    include ActiveModel::Validations
    include ActiveModel::Conversion
    extend ActiveModel::Naming

    attr_accessor :recipients, :subject, :body, :conversation_id, :attachment

    validates :recipients, presence: true
    validates :subject, presence: true
    validates :body, presence: true

    def initialize(attributes = {})
      attributes.each do |name, value|
        send("#{name}=", value)
      end
    end

    def persisted?
      false
    end


    def recipients
      @recipient_list
    end

    def recipients=(string='')
      @recipient_list = []
      string.split(',').each do |s|
        @recipient_list << MessagingUser.find_by_email!(s.strip) unless s.blank?
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
messaging_4-0.0.1 app/models/messaging/message.rb