Class: Seedy::Calls

Inherits:
Record show all
Defined in:
lib/seedy/records/calls.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Record

#initialize, #inspect, #to_s, #to_sql

Constructor Details

This class inherits a constructor from Seedy::Record

Class Method Details

.build(user, team, contact) ⇒ Object



22
23
24
25
26
# File 'lib/seedy/records/calls.rb', line 22

def build(user, team, contact)
  call = Calls.new
  call.associate(user,team,contact)
  call
end

Instance Method Details

#associate(user, team, contact) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/seedy/records/calls.rb', line 29

def associate(user, team, contact)
  write_attribute(:modified_user_id, user.id)
  write_attribute(:assigned_user_id, user.id)
  write_attribute(:team_id, team)
  write_attribute(:created_by, user.id)
  join("calls_contacts", {
    :id => Random.guid, 
    :contact_id => contact, 
    :call_id => read_attribute(:id), 
    :date_modified => read_attribute(:date_modified)})
end