Skip to content

Message WIP ​

An email sent to the subscribers of a given list.

Work in progress

Message content and sending are not implemented yet. See Sending messages.

Columns ​

ColumnTypeNotes
subjectstringrequired
list_idbigintrequired
sender_idbigintrequired
postmark_message_stream_idstring
dispatches_countintegercounter cache, default 0
sent_attimestampbacks the sent boolean

Associations ​

  • belongs_to :list, counter_cache: :messages_count → List
  • belongs_to :sender → Sender
  • has_many :dispatches, dependent: :destroy → Dispatch

Validations ​

  • subject presence

Timestamp booleans ​

sent is backed by sent_at through time_for_a_boolean:

MethodEffect
sent? / senttrue when sent_at is set and in the past
sent!sets sent_at to the current time (doesn't save)
sent = falseclears sent_at

Released under the MIT License.