lib/rails/graphql/source/active_record/builders.rb
def build_reflection_fields(holder)
          each_reflection(holder) do |item|
            next if holder.field?(item.name)
            type_map_after_register(item.klass) do |type|
              next unless (type.object? && type.try(:assigned_to) != item.klass) ||
                type.interface?

              options = reflection_to_options(item)

              if type <= Source::ActiveRecordSource
                source_name = item.collection? ? type.plural : type.singular
                proxy_options = options.merge(alias: reflection.name, of_type: :proxy)

                if (source = type.query_fields[source_name]).present?
                  field = holder.safe_field(source, **proxy_options)
                end
              end

              field ||= holder.field(item.name, type, **options)
              field.before_resolve(:preload_association, item.name)
              field.before_resolve(:build_association_scope, item.name)
              field.resolve(:parent_owned_records, item.collection?)
            end
          end
        end
# Build all necessary reflection fields into the given +holder+
Build all necessary reflection fields into the given +holder+
Build all necessary reflection fields into the given + holder +
def build_reflection_fields(holder)
          each_reflection(holder) do |item|
            next if holder.field?(item.name)
            type_map_after_register(item.klass) do |type|
              next unless (type.object? && type.try(:assigned_to) != item.klass) ||
                type.interface?
              options = reflection_to_options(item)
              if type <= Source::ActiveRecordSource
                source_name = item.collection? ? type.plural : type.singular
                proxy_options = options.merge(alias: reflection.name, of_type: :proxy)
                if (source = type.query_fields[source_name]).present?
                  field = holder.safe_field(source, **proxy_options)
                end
              end
              field ||= holder.field(item.name, type, **options)
              field.before_resolve(:preload_association, item.name)
              field.before_resolve(:build_association_scope, item.name)
              field.resolve(:parent_owned_records, item.collection?)
            end
          end
        end
def build_reflection_fields ( holder ) each_reflection ( holder ) do | item | next if holder . field? ( item . name ) type_map_after_register ( item . klass ) do | type | next unless ( type . object? && type . try ( :assigned_to ) != item . klass ) || type . interface? options = reflection_to_options ( item ) if type <= Source :: ActiveRecordSource source_name = item . collection? ? type . plural : type . singular proxy_options = options . merge ( alias : reflection . name , of_type : :proxy ) if ( source = type . query_fields [ source_name ] ) . present? field = holder . safe_field ( source , ** proxy_options ) end end field ||= holder . field ( item . name , type , ** options ) field . before_resolve ( :preload_association , item . name ) field . before_resolve ( :build_association_scope , item . name ) field . resolve ( :parent_owned_records , item . collection? ) end end end
Build all necessary reflection fields into the given +holder+
Build all necessary reflection fields into the given + holder +
holder