Sha256: ce52fda4d88e1af708022f2d5eb8025c82fbcf4e2951b152ec5e9dbbf248ae92
Contents?: true
Size: 613 Bytes
Versions: 18
Compression:
Stored size: 613 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 Track < ActiveRecord::Base # Register both primary key columns with composite_primary_keys self.primary_keys = :singerid, :albumid, :trackid belongs_to :album, foreign_key: [:singerid, :albumid] belongs_to :singer, foreign_key: :singerid, counter_cache: true def initialize attributes = nil super self.singer ||= self.album&.singer end def album=value super self.singer = value&.singer end end
Version data entries
18 entries across 18 versions & 1 rubygems