fb127c0d42
Given a model with a composite primary key: ```ruby class Order < ActiveRecord::Base self.primary_key = [:shop_id, :id] end ``` `ActiveRecord::Base#id` method will return an array of values for every column of the primary key. ```ruby order = Order.create!(shop_id: 1, id: 2) order.id # => [1, 2] ``` The `id` column is accessible through the `read_attribute` method: ```ruby order.read_attribute(:id) # => 2 ```
5 lines
88 B
Ruby
5 lines
88 B
Ruby
# frozen_string_literal: true
|
|
|
|
require_relative "cpk/book"
|
|
require_relative "cpk/order"
|