Module: CoreAccount

Extended by:
ActiveSupport::Concern
Defined in:
lib/app/models/concerns/core_account.rb

Overview

The System configuration. Various configuration items that can be updated/defined at run time

Use of this class allows you to simply ask for the configuration parameter directly without first having to get an instance of it.

SystemConfiguration.queue_impl #=> ‘RedisQueue’

This method only is allowed for accessors, you should NEVER set values on the SystemConfiguration unless you are updating via the Admin or Stack UI, or during testing to setup a specific configuration for that.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/app/models/concerns/core_account.rb', line 18

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

Instance Method Details

#fetch_smtp_configurationObject

Return or build the smtp configuration for the account



48
49
50
# File 'lib/app/models/concerns/core_account.rb', line 48

def fetch_smtp_configuration
  smtp_configuration || build_smtp_configuration
end