Skip to content

List ​

A list of subscribers, i.e. a newsletter. It uses a specific Message Stream to send messages through Postmark.

Columns ​

ColumnTypeNotes
namestringrequired
sender_idbigintdefault sender, required
postmark_message_stream_idstringPostmark Message Stream used to send messages
subscriptions_countintegercounter cache, default 0
messages_countintegercounter cache, default 0
last_message_sent_attimestamp

Associations ​

  • belongs_to :sender → Sender
  • has_many :subscriptions, dependent: :destroy → Subscription
  • has_many :subscribers, through: :subscriptions → Subscriber
  • has_many :messages, dependent: :destroy → Message

Validations ​

  • name presence
  • sender presence (required belongs_to)

TIP

subscriptions_count and subscribers include suppressed subscriptions. Use list.subscriptions.not_suppressed for active ones.

Released under the MIT License.