Class: Deal

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
E9::ActiveRecord::TimeScopes, E9Rails::ActiveRecord::InheritableOptions, E9Rails::ActiveRecord::Initialization
Defined in:
app/models/deal.rb

Overview

Generated from a Lead, owned by a Campaign. Deals represent potential “deals” with contacts and track revenue used for marketing reports.

Defined Under Namespace

Modules: Status Classes: Drop

Instance Attribute Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args) ⇒ Object (protected)



100
101
102
103
104
105
106
# File 'app/models/deal.rb', line 100

def method_missing(method_name, *args)
  if method_name =~ /(.*)\?$/ && Status::OPTIONS.member?($1)
    self.status == $1
  else
    super
  end
end

Instance Attribute Details

#mailing_list_idsObject

mailing_list_ids may be set on Deals when they are being created as leads, this is done via opt-in checkboxes on the form



60
61
62
# File 'app/models/deal.rb', line 60

def mailing_list_ids
  @mailing_list_ids
end

Instance Method Details

#closed?Boolean

Returns:

  • (Boolean)


86
87
88
# File 'app/models/deal.rb', line 86

def closed?
  [Status::Won, Status::Lost].include? status
end

#to_liquidObject



82
83
84
# File 'app/models/deal.rb', line 82

def to_liquid
  Drop.new(self)
end