Sha256: ae8e1f60f7633e38b806608e76f82f4bc3b97dbcb7242bb837bcd64dabc263a4

Contents?: true

Size: 623 Bytes

Versions: 5

Compression:

Stored size: 623 Bytes

Contents

class Department < ActiveRecord::Base
  self.primary_keys = :id, :location_id

  has_many :employees,
           # We intentionally redefine primary key for test purposes. #455
           :primary_key =>  [:id, :location_id],
           :foreign_key => [:department_id, :location_id]

  has_many :comments, :through => :employees

  has_one :head, :class_name => 'Employee',  :autosave => true, :dependent => :delete,
                 # We intentionally redefine primary key for test purposes. #455
                 :primary_key =>  [:id, :location_id],
                 :foreign_key => [:department_id, :location_id]

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
composite_primary_keys-13.0.8 test/fixtures/department.rb
composite_primary_keys-14.0.1 test/fixtures/department.rb
composite_primary_keys-13.0.1 test/fixtures/department.rb
composite_primary_keys-13.0.0 test/fixtures/department.rb
composite_primary_keys-12.0.10 test/fixtures/department.rb