Sha256: 28bb3341c932127ba79bc0613ba6ce36e4254be5c7b87883863bdd47e8398b53

Contents?: true

Size: 652 Bytes

Versions: 9

Compression:

Stored size: 652 Bytes

Contents

# Copyright 2021 Google LLC
#
# Use of this source code is governed by an MIT-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT.

class Album < ActiveRecord::Base
  # Register both primary key columns with composite_primary_keys
  self.primary_keys = :singerid, :albumid

  # The relationship with singer is not really a foreign key, but an INTERLEAVE IN relationship. We still need to
  # use the `foreign_key` attribute to indicate which column to use for the relationship.
  belongs_to :singer, foreign_key: :singerid
  has_many :tracks, foreign_key: [:singerid, :albumid], dependent: :delete_all
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
activerecord-spanner-adapter-1.6.3 acceptance/models/album.rb
activerecord-spanner-adapter-1.6.2 acceptance/models/album.rb
activerecord-spanner-adapter-1.6.1 acceptance/models/album.rb
activerecord-spanner-adapter-1.6.0 acceptance/models/album.rb
activerecord-spanner-adapter-1.5.1 acceptance/models/album.rb
activerecord-spanner-adapter-1.5.0 acceptance/models/album.rb
activerecord-spanner-adapter-1.4.4 acceptance/models/album.rb
activerecord-spanner-adapter-1.4.3 acceptance/models/album.rb
activerecord-spanner-adapter-1.4.2 acceptance/models/album.rb