Sha256: 06c2a76be55be1f847d0cbdbca476b3db652330ef33cc9bc0f5d30094a8b5b55

Contents?: true

Size: 1.12 KB

Versions: 2

Compression:

Stored size: 1.12 KB

Contents

module Seedy
  class Calls < Record
    self.columns = {
      :id => :guid,
      :name => :subject,
      :date_entered => :date_time,
      :date_modified => :date_time,
      :modified_user_id => :association,
      :created_by => :association,
      :description => :description,
      :deleted => 0,
      :assigned_user_id => :association,
      :team_id => :association,
      :duration_hours => :duration,
      :durection_minutes => :duration,
      :date_start => :date_time,
      :status => :status,
      :direction => :direction,
    }

    class << self
      def build(user, team, contact)
        call = Calls.new
        call.associate(user,team,contact)
        call
      end
    end
    
    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
  end 
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
seedy-0.6.4 lib/seedy/records/calls.rb
seedy-0.6.3 lib/seedy/records/calls.rb