Sha256: 0166dce9050c49cf0178ec7259932fe86512d545ecfe01beab1668308c8c4fce

Contents?: true

Size: 818 Bytes

Versions: 2

Compression:

Stored size: 818 Bytes

Contents

module ActiveRecord
  class NonScalarPrimaryKeyError < ActiveRecordError
    def initialize(reflection)
      super("Can not join association #{reflection.name.inspect}, because :primary_key is a callable. Use Relation#includes or specify a join column name")
    end
  end

  module Associations
    class JoinDependency
      class JoinAssociation
        safe_monkeypatch :initialize, md5: '2332c88140aa9e9efa96975fd48e6958'

        def initialize(reflection, children)

          # PATCH here
          if reflection.options[:primary_key].respond_to?(:call)
            raise NonScalarPrimaryKeyError.new(reflection)
          end
          # end PATCH

          super(reflection.klass, children)

          @reflection      = reflection
          @tables          = nil
        end
      end
    end
  end
end

Version data entries

2 entries across 1 versions & 1 rubygems

Version Path
includes_many-0.1.0 lib/includes_many/active_record41/join_association.rb
includes_many-0.1.0 lib/includes_many/active_record42/join_association.rb