Class: Offer

Inherits:
Renderable
  • Object
show all
Includes:
E9Rails::ActiveRecord::InheritableOptions, E9Rails::ActiveRecord::Initialization, E9Rails::ActiveRecord::STI
Defined in:
app/models/offer.rb

Overview

A Renderable which “offers” the user something. Responses to these offers are tracked as Leads

Defined Under Namespace

Modules: Identifiers Classes: Drop

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.conversion_emailObject



36
37
38
# File 'app/models/offer.rb', line 36

def conversion_email
  SystemEmail.find_by_identifier(Identifiers::CONVERSION_EMAIL)
end

.elementObject



48
49
50
# File 'app/models/offer.rb', line 48

def element
  'offer'
end

.pageObject



40
41
42
# File 'app/models/offer.rb', line 40

def page
  SystemPage.find_by_identifier(Identifiers::PAGE)
end

.partial_pathObject



44
45
46
# File 'app/models/offer.rb', line 44

def partial_path
  'e9_crm/offers/offer'
end

Instance Method Details

#has_mailing_list?(ml) ⇒ Boolean

Returns:

  • (Boolean)


25
26
27
# File 'app/models/offer.rb', line 25

def has_mailing_list?(ml)
  (mailing_list_ids || []).map(&:to_s).member?(ml.id.to_s)
end

#mailing_listsObject



29
30
31
32
33
# File 'app/models/offer.rb', line 29

def mailing_lists
  @_mailing_lists ||= begin
    mailing_list_ids ? MailingList.find_all_by_id(mailing_list_ids) : []
  end
end

#to_liquidObject



57
58
59
# File 'app/models/offer.rb', line 57

def to_liquid
  Drop.new(self)
end

#to_sObject



53
54
55
# File 'app/models/offer.rb', line 53

def to_s
  name
end