Class: ViewEmailTemplate
- Inherits:
-
ApplicationViewRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- ApplicationViewRecord
- ViewEmailTemplate
- Includes:
- Models::SearchableView, PgSearch::Model
- Defined in:
- app/models/view_email_template.rb
Overview
== Schema Information
Table name: view_email_templates
Database name: primary
id :integer primary key
bcc :string(255)
body :text
body_v4 :text
body_v4_email :text
category :string
cc :string(255)
css :text
css_v4 :text
default_from :string
default_reply_to :string
description :string(255)
disable_premailer :boolean
disable_rich_editing :boolean
from :string(255)
group :string
last_used :datetime
preview_text :string
redactor_4_ready :boolean
referenced_in_activity :boolean
referenced_in_campaign :boolean
resource_type :string(255)
state :integer
stylesheet :string(255)
subject :string(255)
system_code :string(20)
template :string
to :string(255)
uses_redactor_v4 :boolean
created_at :datetime
updated_at :datetime
creator_id :integer
resource_id :integer
updater_id :integer
Belongs to collapse
Class Method Summary collapse
- .ransackable_associations(_auth_object = nil) ⇒ Object
-
.ransackable_attributes(_auth_object = nil) ⇒ Object
Ransack configuration.
Instance Method Summary collapse
Methods included from Models::SearchableView
#crm_link, #crm_link_subtitle, #has_columns?, #main_resource, #readonly?
Methods inherited from ApplicationViewRecord
Methods inherited from ApplicationRecord
ransackable_scopes, ransortable_attributes, #to_relation
Methods included from Models::EventPublishable
Class Method Details
.ransackable_associations(_auth_object = nil) ⇒ Object
59 60 61 |
# File 'app/models/view_email_template.rb', line 59 def self.ransackable_associations(_auth_object = nil) %w[resource] end |
.ransackable_attributes(_auth_object = nil) ⇒ Object
Ransack configuration
51 52 53 54 55 56 57 |
# File 'app/models/view_email_template.rb', line 51 def self.ransackable_attributes(_auth_object = nil) %w[ id description subject body system_code state category template group resource_type resource_id created_at updated_at redactor_4_ready referenced_in_campaign referenced_in_activity last_used ] end |
Instance Method Details
#ok_to_delete? ⇒ Boolean
70 71 72 |
# File 'app/models/view_email_template.rb', line 70 def ok_to_delete? !referenced_in_activity? and !referenced_in_campaign? and system_code.blank? end |
#referenced_in ⇒ Object
63 64 65 66 67 68 |
# File 'app/models/view_email_template.rb', line 63 def referenced_in ref = [] ref << 'Activity' if referenced_in_activity? ref << 'Campaign' if referenced_in_campaign? ref.join(', ') end |
#resource ⇒ Resource
48 |
# File 'app/models/view_email_template.rb', line 48 belongs_to :resource, polymorphic: true, optional: true |