Sha256: 61e10851757ae2e559cc6a5d4c8e6073dac3dd066c260f62c94cabd004b42ecb
Contents?: true
Size: 1.14 KB
Versions: 43
Compression:
Stored size: 1.14 KB
Contents
# frozen_string_literal: true # # The Base Account # module CoreAccount extend ActiveSupport::Concern def self.included(base) base.class_eval do # # Fields # field :name, type: String # # Relationships # has_many :notifications, dependent: :destroy do def emails where(_type: 'EmailNotification') end def slacks where(_type: 'SlackNotification') end def sms where(_type: 'SmsNotification') end end has_many :templates, dependent: :destroy embeds_one :smtp_configuration end end # # Return or build the smtp configuration for the account # def fetch_smtp_configuration smtp_configuration || build_smtp_configuration end # # return the email notifications templates, these are custom notifications sent by an admin. # def email_notification_templates templates.where(_type: 'EmailNotificationTemplate') end # # return the email templates, these are email templates for actions in the system # def email_templates templates.where(_type: 'EmailTemplate') end end
Version data entries
43 entries across 43 versions & 1 rubygems