Sha256: 12d2115c351b1895ada025595f2529f538dd79b0255271d03520d80dc70e0fab

Contents?: true

Size: 501 Bytes

Versions: 12

Compression:

Stored size: 501 Bytes

Contents

module Graphiti
  module Adapters
    module ActiveRecord
      module Inferrence
        # If going AR to AR, use AR introspection
        # If going AR to PORO, fall back to normal inferrence
        def infer_foreign_key
          parent_model = parent_resource_class.model
          reflection = parent_model.reflections[association_name.to_s]
          if reflection
            reflection.foreign_key.to_sym
          else
            super
          end
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
graphiti-1.0.alpha.18 lib/graphiti/adapters/active_record/inferrence.rb
graphiti-1.0.alpha.17 lib/graphiti/adapters/active_record/inferrence.rb
graphiti-1.0.alpha.16 lib/graphiti/adapters/active_record/inferrence.rb
graphiti-1.0.alpha.15 lib/graphiti/adapters/active_record/inferrence.rb
graphiti-1.0.alpha.14 lib/graphiti/adapters/active_record/inferrence.rb
graphiti-1.0.alpha.12 lib/graphiti/adapters/active_record/inferrence.rb
graphiti-1.0.alpha.11 lib/graphiti/adapters/active_record/inferrence.rb
graphiti-1.0.alpha.10 lib/graphiti/adapters/active_record/inferrence.rb
graphiti-1.0.alpha.9 lib/graphiti/adapters/active_record/inferrence.rb
graphiti-1.0.alpha.8 lib/graphiti/adapters/active_record/inferrence.rb
graphiti-1.0.alpha.7 lib/graphiti/adapters/active_record/inferrence.rb
graphiti-1.0.alpha.6 lib/graphiti/adapters/active_record/inferrence.rb