Sha256: 4c42c52012b63b053d193fad9fbced33ba668319a9bf3dd0a734c335b92d0631

Contents?: true

Size: 1.08 KB

Versions: 6

Compression:

Stored size: 1.08 KB

Contents

##
## 2023-03-04 _vp_ When I receive one.
## 2023-03-04 _vp_ When I send one, forever.
##
class WcoEmail::EmailActionTemplate
  include Mongoid::Document
  include Mongoid::Timestamps
  include Mongoid::Paranoia
  store_in collection: 'wco_email_email_actions'

  field :slug, type: :string
  validates :slug, uniqueness: true, allow_nil: true
  index({ slug: 1 }, { unique: true, name: "slug_idx" })

  belongs_to :email_template, class_name: 'WcoEmail::EmailTemplate'
  def tmpl; email_template; end

  has_many :scheduled_email_actions, class_name: 'WcoEmail::ScheduledEmailAction'
  def schs; scheduled_email_actions; end

  has_many :ties,      class_name: 'WcoEmail::EmailActionTie', inverse_of: :email_action
  has_many :prev_ties, class_name: 'WcoEmail::EmailActionTie', inverse_of: :next_email_action
  accepts_nested_attributes_for :ties

  has_many :email_filters, class_name: 'WcoEmail::EmailFilter', inverse_of: :email_action

  ## @TODO: change this right now.
  field :deleted_at, default: nil, type: :time

  def self.list
    [[nil,nil]] + all.map { |a| [ a.slug, a.id ] }
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
wco_models-3.1.0.61 app/models/wco_email/email_action_template.rb
wco_models-3.1.0.60 app/models/wco_email/email_action_template.rb
wco_models-3.1.0.59 app/models/wco_email/email_action_template.rb
wco_models-3.1.0.58 app/models/wco_email/email_action_template.rb
wco_models-3.1.0.57 app/models/wco_email/email_action_template.rb
wco_models-3.1.0.56 app/models/wco_email/email_action_template.rb