Sha256: 3acacccf7befa2be9060ea98baa9f4f195130926fcce3936fd56457f1f5e30ca
Contents?: true
Size: 1.14 KB
Versions: 44
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: :delete do def emails where(_type: 'EmailNotification') end def slacks where(_type: 'SlackNotification') end def sms where(_type: 'SmsNotification') end end has_many :templates, dependent: :delete 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
44 entries across 44 versions & 1 rubygems