You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: context.rb
    path of file: ./repos/ransack/lib/ransack/adapters/active_record
    
    the code of the file until where you have to start completion: require 'ransack/context'
require 'polyamorous/polyamorous'

module Ransack
  module Adapters
    module ActiveRecord
      class Context < ::Ransack::Context

        def relation_for(object)
          object.all
        end

        def type_for(attr)
          return nil unless attr && attr.valid?
          relation     = attr.arel_attribute.r
    
        def build_association(name, parent = @base, klass = nil)
          jd = Polyamorous::JoinDependency.new(
            parent.base_klass,
            parent.table,
            Polyamorous::Join.new(name, @join_type, klass),
            @join_type
          )
          found_association = jd.instance_variable_get(:@join_root).children.last

          @associations_pot[found_association] = parent

          # TODO maybe we dont need to push associations here, we could loop
          # through the @associations_pot instead
          @join_dependency.instance_variable_get(:@join_root).children.push found_association

          # Builds the arel nodes properly for this association
          @tables_pot[found_association] = @join_dependency.construct_tables_for_association!(jd.instance_variable_get(:@join_root), found_association)

          # Leverage the stashed association functionality in AR
          @object = @object.joins(jd)
          found_association
        end

        def extract_joins(association)
          parent = @join_dependency.instance_variable_get(:@join_root)
          reflection = association.reflection
          join_constraints = association.join_constraints_with_tables(
                               parent.table,
                               parent.base_klass,
                               Arel::Nodes::OuterJoin,
                               @join_dependency.instance_variable_get(:@alias_tracker),
                               @tables_pot[association]
                             )
          join_constraints.to_a.flatten
        end
      end