Sha256: 04ca73dbdf68ed4636326bbb315efb647e3e9339a7769721a8ac593c31fbc684

Contents?: true

Size: 414 Bytes

Versions: 42

Compression:

Stored size: 414 Bytes

Contents

class Email < ApplicationRecord
  validates :from_name, :to_name, :subject, :plain_content, :html_content,
            presence: true
  validates :from_email, :to_email, email: true
  validates :cc, :bcc, email: true, allow_blank: true

  scope :sent, -> { where('sent_at IS NOT NULL') }
  scope :not_sent, -> { where('sent_at IS NULL') }

  def mark_as_sent!
    update_attribute :sent_at, DateTime.now
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
udongo-4.0.0 app/models/email.rb
udongo-3.0.0 app/models/email.rb