Что вызывает эту неопределенную ошибку метода в моем проекте Ruby on Rails / GraphQL - PullRequest
0 голосов
/ 06 октября 2019

Я работаю над проектом с GraphQL впервые, и у меня возникла небольшая загвоздка, которую я не могу понять. У меня есть бизнес-модель, модель пользователя и отраслевая модель. Бизнес-модель принадлежит обеим другим моделям. Операции представления в скаффолде выполняются, как и ожидалось, но когда я запускаю запрос Graph для предприятий и включаю любую из двух других моделей, он выдает ошибку с

неопределенным методом `map 'для #User: 0x00007fadeb73f140> \Вы имели в виду? нажмите

Вот мое определение в query_type.rb:

# get all businesses
    field :businesses, [Types::BusinessType], null: false, description: "List of all businesses"

    def businesses
      Business.all

    end

А вот мой BusinessType:

module Types
  class BusinessType < BaseObject
    field :id, ID, null: false
    field :name, String, null: false
    field :zip_code, String, null: true
    field :growth_stage, String, null: true
    field :annual_revenue, Integer, null: true
    field :first_name, String, null: false
    field :last_name, String, null: false
    field :email, String, null: false
    field :phone, String, null: false
    field :industry, type: [Types::IndustryType], null: true
    field :user, type: [Types::UserType], null: true
  end
end

А вот мой запрос графика:

{
  businesses {
    id
    name
    growthStage
    annualRevenue
    firstName
    lastName
    email
    phone 
    zipCode
    user {
      email
    }
    industry {
      name
    }
  }
}

вот трассировка стека:

"/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activemodel-6.0.0/lib/active_model/attribute_methods.rb:431:in `method_missing'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/schema/member/instrumentation.rb:93:in `proxy_to_depth'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/schema/member/instrumentation.rb:85:in `call'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/field.rb:248:in `resolve'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/execution/execute.rb:321:in `call'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/schema/middleware_chain.rb:49:in `invoke_core'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/schema/middleware_chain.rb:38:in `invoke'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/execution/execute.rb:129:in `block in resolve_field'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/tracing.rb:62:in `block in trace'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/tracing.rb:76:in `call_tracers'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/tracing.rb:62:in `trace'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/execution/execute.rb:128:in `resolve_field'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/execution/execute.rb:92:in `block in resolve_selection'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/execution/execute.rb:85:in `each'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/execution/execute.rb:85:in `resolve_selection'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/execution/execute.rb:284:in `resolve_value'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/execution/execute.rb:278:in `resolve_value'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/execution/execute.rb:213:in `continue_resolve_field'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/execution/execute.rb:184:in `continue_or_wait'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/execution/execute.rb:263:in `block in resolve_value'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/execution/execute.rb:256:in `each'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/execution/execute.rb:256:in `resolve_value'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/execution/execute.rb:278:in `resolve_value'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/execution/execute.rb:213:in `continue_resolve_field'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/execution/execute.rb:184:in `continue_or_wait'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/execution/execute.rb:157:in `resolve_field'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/execution/execute.rb:92:in `block in resolve_selection'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/execution/execute.rb:85:in `each'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/execution/execute.rb:85:in `resolve_selection'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/execution/execute.rb:56:in `block in resolve_root_selection'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/tracing.rb:62:in `block in trace'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/tracing.rb:76:in `call_tracers'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/tracing.rb:62:in `trace'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/execution/execute.rb:49:in `resolve_root_selection'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/execution/execute.rb:31:in `begin_query'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/execution/multiplex.rb:112:in `begin_query'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/execution/multiplex.rb:84:in `block in run_as_multiplex'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/execution/multiplex.rb:83:in `map'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/execution/multiplex.rb:83:in `run_as_multiplex'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/execution/multiplex.rb:62:in `block (2 levels) in run_queries'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/execution/multiplex.rb:186:in `block in instrument_and_analyze'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/execution/instrumentation.rb:29:in `block (2 levels) in apply_instrumenters'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/execution/instrumentation.rb:46:in `block (2 levels) in each_query_call_hooks'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/execution/instrumentation.rb:41:in `each_query_call_hooks'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/execution/instrumentation.rb:45:in `block in each_query_call_hooks'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/execution/instrumentation.rb:72:in `call_hooks'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/execution/instrumentation.rb:44:in `each_query_call_hooks'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/execution/instrumentation.rb:27:in `block in apply_instrumenters'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/execution/instrumentation.rb:72:in `call_hooks'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/execution/instrumentation.rb:26:in `apply_instrumenters'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/execution/multiplex.rb:174:in `instrument_and_analyze'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/execution/multiplex.rb:61:in `block in run_queries'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/tracing.rb:62:in `block in trace'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/tracing.rb:76:in `call_tracers'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/tracing.rb:62:in `trace'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/execution/multiplex.rb:59:in `run_queries'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/execution/multiplex.rb:49:in `run_all'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/schema.rb:392:in `block in multiplex'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/schema.rb:1279:in `with_definition_error_check'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/schema.rb:391:in `multiplex'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/graphql-1.9.12/lib/graphql/schema.rb:368:in `execute'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/2.6.0/forwardable.rb:230:in `execute'",
      "/private/var/sites/clients/army_of_bees/finsync/ap-backend-temp/app/controllers/graphql_controller.rb:12:in `execute'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/actionpack-6.0.0/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/actionpack-6.0.0/lib/abstract_controller/base.rb:196:in `process_action'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/actionpack-6.0.0/lib/action_controller/metal/rendering.rb:30:in `process_action'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/actionpack-6.0.0/lib/abstract_controller/callbacks.rb:42:in `block in process_action'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0/lib/active_support/callbacks.rb:135:in `run_callbacks'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/actionpack-6.0.0/lib/abstract_controller/callbacks.rb:41:in `process_action'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/actionpack-6.0.0/lib/action_controller/metal/rescue.rb:22:in `process_action'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/actionpack-6.0.0/lib/action_controller/metal/instrumentation.rb:33:in `block in process_action'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0/lib/active_support/notifications.rb:180:in `block in instrument'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0/lib/active_support/notifications/instrumenter.rb:24:in `instrument'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0/lib/active_support/notifications.rb:180:in `instrument'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/actionpack-6.0.0/lib/action_controller/metal/instrumentation.rb:32:in `process_action'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/actionpack-6.0.0/lib/action_controller/metal/params_wrapper.rb:245:in `process_action'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0/lib/active_record/railties/controller_runtime.rb:27:in `process_action'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/actionpack-6.0.0/lib/abstract_controller/base.rb:136:in `process'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/actionview-6.0.0/lib/action_view/rendering.rb:39:in `process'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/actionpack-6.0.0/lib/action_controller/metal.rb:191:in `dispatch'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/actionpack-6.0.0/lib/action_controller/metal.rb:252:in `dispatch'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/actionpack-6.0.0/lib/action_dispatch/routing/route_set.rb:51:in `dispatch'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/actionpack-6.0.0/lib/action_dispatch/routing/route_set.rb:33:in `serve'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/actionpack-6.0.0/lib/action_dispatch/journey/router.rb:49:in `block in serve'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/actionpack-6.0.0/lib/action_dispatch/journey/router.rb:32:in `each'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/actionpack-6.0.0/lib/action_dispatch/journey/router.rb:32:in `serve'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/actionpack-6.0.0/lib/action_dispatch/routing/route_set.rb:837:in `call'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rack-2.0.7/lib/rack/tempfile_reaper.rb:15:in `call'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rack-2.0.7/lib/rack/etag.rb:25:in `call'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rack-2.0.7/lib/rack/conditional_get.rb:38:in `call'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rack-2.0.7/lib/rack/head.rb:12:in `call'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/actionpack-6.0.0/lib/action_dispatch/http/content_security_policy.rb:18:in `call'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rack-2.0.7/lib/rack/session/abstract/id.rb:232:in `context'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rack-2.0.7/lib/rack/session/abstract/id.rb:226:in `call'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/actionpack-6.0.0/lib/action_dispatch/middleware/cookies.rb:648:in `call'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0/lib/active_record/migration.rb:567:in `call'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/actionpack-6.0.0/lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0/lib/active_support/callbacks.rb:101:in `run_callbacks'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/actionpack-6.0.0/lib/action_dispatch/middleware/callbacks.rb:26:in `call'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/actionpack-6.0.0/lib/action_dispatch/middleware/executor.rb:14:in `call'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/actionpack-6.0.0/lib/action_dispatch/middleware/actionable_exceptions.rb:17:in `call'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/actionpack-6.0.0/lib/action_dispatch/middleware/debug_exceptions.rb:32:in `call'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/web-console-4.0.1/lib/web_console/middleware.rb:132:in `call_app'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/web-console-4.0.1/lib/web_console/middleware.rb:28:in `block in call'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/web-console-4.0.1/lib/web_console/middleware.rb:17:in `catch'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/web-console-4.0.1/lib/web_console/middleware.rb:17:in `call'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/actionpack-6.0.0/lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-6.0.0/lib/rails/rack/logger.rb:38:in `call_app'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-6.0.0/lib/rails/rack/logger.rb:26:in `block in call'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0/lib/active_support/tagged_logging.rb:80:in `block in tagged'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0/lib/active_support/tagged_logging.rb:28:in `tagged'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0/lib/active_support/tagged_logging.rb:80:in `tagged'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-6.0.0/lib/rails/rack/logger.rb:26:in `call'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/quiet_assets.rb:13:in `call'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/actionpack-6.0.0/lib/action_dispatch/middleware/remote_ip.rb:81:in `call'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/actionpack-6.0.0/lib/action_dispatch/middleware/request_id.rb:27:in `call'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rack-2.0.7/lib/rack/method_override.rb:22:in `call'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rack-2.0.7/lib/rack/runtime.rb:22:in `call'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/actionpack-6.0.0/lib/action_dispatch/middleware/executor.rb:14:in `call'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/actionpack-6.0.0/lib/action_dispatch/middleware/static.rb:126:in `call'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rack-2.0.7/lib/rack/sendfile.rb:111:in `call'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/actionpack-6.0.0/lib/action_dispatch/middleware/host_authorization.rb:83:in `call'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rack-cors-1.0.3/lib/rack/cors.rb:95:in `call'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-6.0.0/lib/rails/engine.rb:526:in `call'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/puma-3.12.1/lib/puma/configuration.rb:227:in `call'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/puma-3.12.1/lib/puma/server.rb:660:in `handle_request'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/puma-3.12.1/lib/puma/server.rb:474:in `process_client'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/puma-3.12.1/lib/puma/server.rb:334:in `block in run'",
      "/Users/xxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/puma-3.12.1/lib/puma/thread_pool.rb:135:in `block in spawn_thread'"

1 Ответ

0 голосов
/ 07 октября 2019

Мне удалось решить эту проблему, изменив следующую строку в business_type.rb:

field :user, type: [Types::UserType], null: false

на

field :user, Types::UserType, null: false

ОБНОВЛЕНИЕ: Оказывается, чтопервый пример должен работать только со списками объектов, а второй - с отдельными объектами

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...