Sha256: f389f77ae95ad2dc9a2eabb05461e9bc33388035859081f856a763bd2f02ce1b

Contents?: true

Size: 425 Bytes

Versions: 6

Compression:

Stored size: 425 Bytes

Contents

class Email < ActiveRecord::Base
  validates :from_name, :to_name, :subject, :plain_content, :html_content,
            presence: true
  validates :from_email, :to_email,
            format: { with: /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i }

  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

6 entries across 6 versions & 1 rubygems

Version Path
udongo-1.0.4 app/models/email.rb
udongo-1.0.3 app/models/email.rb
udongo-1.0.2 app/models/email.rb
udongo-1.0.1 app/models/email.rb
udongo-1.0.0 app/models/email.rb
udongo-0.1.0 app/models/email.rb