Sha256: 4f5a0dc3765408530aee751eacedf274377323656018089fc57c4555ddfe2fa0
Contents?: true
Size: 691 Bytes
Versions: 8
Compression:
Stored size: 691 Bytes
Contents
module CompositePrimaryKeys module SingularAssociation extend ActiveSupport::Concern included do def get_records_with_cpk_support cpk_applies = (target && target.composite?) || (owner && owner.composite?) || (options[:primary_key] && options[:primary_key].kind_of?(Array)) || (options[:foreign_key] && options[:foreign_key].kind_of?(Array)) return scope.limit(1).to_a if cpk_applies get_records_without_cpk_support end alias_method_chain :get_records, :cpk_support end end end ActiveRecord::Associations::SingularAssociation.send(:include, CompositePrimaryKeys::SingularAssociation)
Version data entries
8 entries across 8 versions & 1 rubygems