Sha256: 0a98977c4815a88f5af0933c1dccf6e9c8dd7cfc4fd650e0328d753e35c0c03a
Contents?: true
Size: 603 Bytes
Versions: 1
Compression:
Stored size: 603 Bytes
Contents
module Decidim # This model holds all the data needed to send a newsletter. class Newsletter < ApplicationRecord belongs_to :author, class_name: User belongs_to :organization validates :subject, :body, presence: true validate :author_belongs_to_organization # Returns true if this newsletter was already sent. # # Returns a Boolean. def sent? sent_at.present? end private def author_belongs_to_organization return if !author || !organization errors.add(:author, :invalid) unless author.organization == organization end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
decidim-core-0.0.5 | app/models/decidim/newsletter.rb |