Sha256: cdcad2f66060d07d72f3e9889b28cd7830e5d7e066f96b2f5b78f88b4d3c76a3
Contents?: true
Size: 870 Bytes
Versions: 2
Compression:
Stored size: 870 Bytes
Contents
# frozen_string_literal: true module Torque module PostgreSQL module Reflection module AssociationReflection def initialize(name, scope, options, active_record) super raise ArgumentError, <<-MSG.squish if options[:array] && options[:polymorphic] Associations can't be connected through an array at the same time they are polymorphic. Please choose one of the options. MSG end private # Check if the foreign key should be pluralized def derive_foreign_key result = super result = ActiveSupport::Inflector.pluralize(result) \ if collection? && connected_through_array? result end end ::ActiveRecord::Reflection::AssociationReflection.prepend(AssociationReflection) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
torque-postgresql-2.0.5 | lib/torque/postgresql/reflection/association_reflection.rb |
torque-postgresql-2.0.4 | lib/torque/postgresql/reflection/association_reflection.rb |