class Configurations::General

Schema Information

Table name: configurations

id         :integer          not null, primary key
settings   :text
type       :string(255)
created_at :datetime
updated_at :datetime
university_id :integer

Public Class Methods

application_name() click to toggle source

To get the application name.

# File app/models/configurations/general.rb, line 56
def self.application_name
  ActsAsTenant.current_tenant.try(:name)
end

Public Instance Methods

convert_bcc_list_to_array() click to toggle source

To convert the comma separated bcc string to array format.

# File app/models/configurations/general.rb, line 27
def convert_bcc_list_to_array
  if self.bcc_list.is_a? String
   self.bcc_list = self.bcc_list.split(',').map(&:strip)
  end
end
convert_domain_list_to_array() click to toggle source

To convert the comma separated domain string to array format.

# File app/models/configurations/general.rb, line 34
def convert_domain_list_to_array
  if self.domain_list.is_a? String
    self.domain_list = self.domain_list.split(',').map(&:strip)
  end
end
update_configuration!() click to toggle source

To update the configuration(i.e. setting default mail from)

# File app/models/configurations/general.rb, line 51
def update_configuration!
  ActionMailer::Base.default(from: default_mail_from)
end
validate_bcc_list() click to toggle source

To validate bcc email format.

# File app/models/configurations/general.rb, line 41
def validate_bcc_list
  bcc_list.each do |email|
    unless email =~ /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/
      errors.add(:bcc_list, "are invalid due to #{email}")
      break
    end
  end
end