Sha256: 1e6ab43b7c29498b472fec6ce554aa8979ad8f92c099f8360fa2dfa3c092f646

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

## Work effort associations store precedence, concurrence. They can also store
## task breakdowns, but there is a more efficient nested-set data structure directly on the work_effort
## for this purpose, since it is common to reconstruct large work breakdown structures
## with important read performance requirements

class WorkEffortAssociation < ActiveRecord::Base
  attr_protected :created_at, :updated_at

  belongs_to :work_effort_association_type

  belongs_to :work_effort_from, :class_name => "WorkEffort", :foreign_key => "work_effort_id_from"
  belongs_to :work_effort_to, :class_name => "WorkEffort", :foreign_key => "work_effort_id_to"
  belongs_to :from_role, :class_name => "RoleType", :foreign_key => "role_type_id_from"
  belongs_to :to_role, :class_name => "RoleType", :foreign_key => "role_type_id_to"

  def to_data_hash
    to_hash({
                only: [:id, :work_effort_id_from, :work_effort_id_to, :created_at, :updated_at],
                work_effort_association_type: try(:work_effort_association_type).try(:to_data_hash)
            })
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
erp_work_effort-4.2.0 app/models/work_effort_association.rb