Sha256: 9d56ee2d0efd45c89cc017131e93356dd27bc683a19129a1cca9077802b3462a
Contents?: true
Size: 680 Bytes
Versions: 20
Compression:
Stored size: 680 Bytes
Contents
# frozen_string_literal: true module Nuntius class Subscriber < ApplicationRecord belongs_to :list, counter_cache: :subscribers_count belongs_to :nuntiable, polymorphic: true, optional: true scope :subscribed, -> { where(unsubscribed_at: nil) } def name [first_name, last_name].compact.join(" ").presence || email end def first_name return nuntiable.first_name if nuntiable.respond_to?(:first_name) super end def last_name return nuntiable.last_name if nuntiable.respond_to?(:last_name) super end def email return nuntiable.email if nuntiable.respond_to?(:email) super end end end
Version data entries
20 entries across 20 versions & 1 rubygems