Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 22nd, 2012  |  syntax: None  |  size: 1.00 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. class ConstructionMachine < ActiveRecord::Base
  2.  
  3. #Start epos-db-dependencies
  4.  
  5.  #Table name
  6.    set_table_name "construction_machine"
  7.  
  8.  #Attribut mapping
  9.    primary_key= :cmId
  10.    foreign_key_machine_type= :lmatyId
  11.    foreign_key_employee_group= :empgrpId
  12.    foreign_key_unit_type= :cmSetOutputValue_unitId
  13.    alias_attribute :output_value, :cmSetOutputValue
  14.    alias_attribute :hourly_rate, :cmHourlyRate
  15.    alias_attribute :description, :cmText
  16.  
  17. #End epos-db-dependencies
  18.  
  19. #Map attributes
  20.  set_primary_key primary_key
  21.  alias_attribute :id, primary_key
  22.  alias_attribute :unit_id, foreign_key_unit_type
  23.  alias_attribute :machine_type_id, foreign_key_machine_type
  24.  alias_attribute :employee_group_id, foreign_key_employee_group
  25.  
  26. #Relations
  27.  has_many :operation_times, :foreign_key => primary_key
  28.  belongs_to :i_machine_type, :foreign_key => foreign_key_machine_type
  29.  belongs_to :employee_group, :foreign_key => foreign_key_employee_group
  30.  belongs_to :unit, :foreign_key => foreign_key_unit_type
  31.  
  32. end