Related
I am working on a project with GraphQL for the first time and I've hit a bit of a snag I can't figure out. I have a business model, a user model and an industry model. The business model belongs to both of the other models. Scaffolded view operations run as expected, but when I run a Graph query on businesses and include either of the other two models, it errors out with
undefined method `map' for #User:0x00007fadeb73f140>\nDid you mean?
tap
Here is my definition in query_type.rb:
# get all businesses
field :businesses, [Types::BusinessType], null: false, description: "List of all businesses"
def businesses
Business.all
end
And here is my 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
And here is my Graph query:
{
businesses {
id
name
growthStage
annualRevenue
firstName
lastName
email
phone
zipCode
user {
email
}
industry {
name
}
}
}
here is the stack trace:
"/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'"
I was able to resolve this by changing the following line in business_type.rb:
field :user, type: [Types::UserType], null: false
to
field :user, Types::UserType, null: false
UPDATE: It turns out that the first example should only work with lists of objects and the second with single objects
I've written a script that imports paginated JSON data from an api, encodes the data to UTF-8 and then writes it to a file.
I need to iterate over the data in the file to create records in my database, but am running to an error loading the file so I can do so.
The stack trace isn't telling me much about what's wrong; any help would be greatly appreciated!
code:
require 'net/http'
require 'uri'
require 'json'
require 'faker'
#imports APR User data from the zendesk api, iterates through it and populates the database with it.
uri = URI.parse("https://aprtechsupport.zendesk.com/api/v2/users.json")
request = Net::HTTP::Get.new(uri)
request.content_type = "application/json"
request.basic_auth("cbradford#blah.com", "blah32")
req_options = {
use_ssl: uri.scheme == "https",
}
#response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
http.request(request)
end
res = #response.body
res.force_encoding("utf-8")
resEncoded = JSON.parse(res)
users = resEncoded
#data = {}
#data.merge(users)
results = []
results << resEncoded
puts results
while users["next_page"]
newUri = users["next_page"]
uriLoop = URI.parse(newUri)
puts newUri
requestLoop = Net::HTTP::Get.new(uriLoop)
requestLoop.content_type = "application/json"
requestLoop.basic_auth("cbradford#blah.com", "blah32")
req_optionsLoop = {
use_ssl: uriLoop.scheme == "https",
}
#responseLoop = Net::HTTP.start(uriLoop.hostname, uriLoop.port, req_optionsLoop) do |http|
http.request(requestLoop)
end
dataEncoded = #responseLoop.body
dataEncoded.force_encoding("utf-8")
resLoop = JSON.parse(dataEncoded)
results << resLoop
updateUri = resLoop["next_page"]
users["next_page"] = updateUri
end
puts "hash created Successfully!"
puts results
File.write('blahzendeskusers1.json', results)
puts "File Created Successfully!"
file = File.read('blahzendeskusers1.json')
usersLoop = JSON.load(file)["users"]
usersLoop.each do |a|
User.find_or_create_by(:zendesk_id_int => a["id"], :url => a["url"], :name => a["name"], :email => a["email"],
:phone => a["phone"], :role => a["role"], :default_group_id => a["default_group_id"], :external_id => a["external_id"],
:tags => a["tags"]
)
end
stack trace:
> /Users/christopherbradford/.rbenv/versions/2.3.1/lib/ruby/2.3.0/json/common.rb:156:in
> `parse'
> /Users/christopherbradford/.rbenv/versions/2.3.1/lib/ruby/2.3.0/json/common.rb:156:in
> `parse'
> /Users/christopherbradford/.rbenv/versions/2.3.1/lib/ruby/2.3.0/json/common.rb:335:in
> `load'
> /Users/christopherbradford/railsProjects/aprzendeskdata/db/seeds.rb:84:in
> `<top (required)>'
> /Users/christopherbradford/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.5/lib/active_support/dependencies.rb:286:in `load'
> /Users/christopherbradford/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.5/lib/active_support/dependencies.rb:286:in `block in load'
> /Users/christopherbradford/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.5/lib/active_support/dependencies.rb:258:in `load_dependency'
> /Users/christopherbradford/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.5/lib/active_support/dependencies.rb:286:in `load'
> /Users/christopherbradford/.rvm/gems/ruby-2.4.1/gems/railties-5.1.5/lib/rails/engine.rb:549:in
> `load_seed'
> /Users/christopherbradford/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.5/lib/active_record/tasks/database_tasks.rb:270:in
> `load_seed'
> /Users/christopherbradford/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.5/lib/active_record/railties/databases.rake:184:in
> `block (2 levels) in <top (required)>'
> /Users/christopherbradford/.rvm/gems/ruby-2.4.1/gems/rake-12.3.1/lib/rake/task.rb:271:in
> `block in execute'
> /Users/christopherbradford/.rvm/gems/ruby-2.4.1/gems/rake-12.3.1/lib/rake/task.rb:271:in
> `each'
> /Users/christopherbradford/.rvm/gems/ruby-2.4.1/gems/rake-12.3.1/lib/rake/task.rb:271:in
> `execute'
> /Users/christopherbradford/.rvm/gems/ruby-2.4.1/gems/rake-12.3.1/lib/rake/task.rb:213:in
> `block in invoke_with_call_chain'
> /Users/christopherbradford/.rbenv/versions/2.3.1/lib/ruby/2.3.0/monitor.rb:214:in
> `mon_synchronize'
> /Users/christopherbradford/.rvm/gems/ruby-2.4.1/gems/rake-12.3.1/lib/rake/task.rb:193:in
> `invoke_with_call_chain'
> /Users/christopherbradford/.rvm/gems/ruby-2.4.1/gems/rake-12.3.1/lib/rake/task.rb:182:in
> `invoke'
> /Users/christopherbradford/.rvm/gems/ruby-2.4.1/gems/rake-12.3.1/lib/rake/application.rb:160:in
> `invoke_task'
> /Users/christopherbradford/.rvm/gems/ruby-2.4.1/gems/rake-12.3.1/lib/rake/application.rb:116:in
> `block (2 levels) in top_level'
> /Users/christopherbradford/.rvm/gems/ruby-2.4.1/gems/rake-12.3.1/lib/rake/application.rb:116:in
> `each'
> /Users/christopherbradford/.rvm/gems/ruby-2.4.1/gems/rake-12.3.1/lib/rake/application.rb:116:in
> `block in top_level'
> /Users/christopherbradford/.rvm/gems/ruby-2.4.1/gems/rake-12.3.1/lib/rake/application.rb:125:in
> `run_with_threads'
> /Users/christopherbradford/.rvm/gems/ruby-2.4.1/gems/rake-12.3.1/lib/rake/application.rb:110:in
> `top_level'
> /Users/christopherbradford/.rvm/gems/ruby-2.4.1/gems/rake-12.3.1/lib/rake/application.rb:83:in
> `block in run'
> /Users/christopherbradford/.rvm/gems/ruby-2.4.1/gems/rake-12.3.1/lib/rake/application.rb:186:in
> `standard_exception_handling'
> /Users/christopherbradford/.rvm/gems/ruby-2.4.1/gems/rake-12.3.1/lib/rake/application.rb:80:in
> `run'
> /Users/christopherbradford/.rvm/gems/ruby-2.4.1/gems/rake-12.3.1/exe/rake:27:in
> `<top (required)>'
> /Users/christopherbradford/.rvm/gems/ruby-2.4.1/bin/rake:23:in `load'
> /Users/christopherbradford/.rvm/gems/ruby-2.4.1/bin/rake:23:in
> `<main>' Tasks: TOP => db:seed
Sample File Data:
{"users"=>[{"id"=>360403052546, "url"=>"https://aprtechsupport.zendesk.com/api/v2/users/360403052546.json", "name"=>"Caller +1 (650) 434-4313", "email"=>nil, "created_at"=>"2018-03-05T19:36:00Z", "updated_at"=>"2018-03-05T19:36:00Z", "time_zone"=>"Pacific Time (US & Canada)", "phone"=>"+16504344313", "shared_phone_number"=>false, "photo"=>nil, "locale_id"=>1, "locale"=>"en-US", "organization_id"=>nil, "role"=>"end-user", "verified"=>true, "external_id"=>nil, "tags"=>[], "alias"=>nil, "active"=>true, "shared"=>false, "shared_agent"=>false, "last_login_at"=>nil, "two_factor_auth_enabled"=>false, "signature"=>nil, "details"=>nil, "notes"=>nil, "role_type"=>nil, "custom_role_id"=>nil, "moderator"=>false, "ticket_restriction"=>"requested", "only_private_comments"=>false, "restricted_agent"=>true, "suspended"=>false, "chat_only"=>false, "default_group_id"=>nil, "user_fields"=>{}}, {"id"=>360404721566, "url"=>"https://aprtechsupport.zendesk.com/api/v2/users/360404721566.json", "name"=>"renglehart", "email"=>"renglehart#apr.com", "created_at"=>"2018-03-06T00:29:39Z", "updated_at"=>"2018-03-07T19:00:58Z", "time_zone"=>"Pacific Time (US & Canada)", "phone"=>nil, "shared_phone_number"=>nil, "photo"=>nil, "locale_id"=>1, "locale"=>"en-US", "organization_id"=>nil, "role"=>"end-user", "verified"=>true, "external_id"=>nil, "tags"=>[], "alias"=>nil, "active"=>true, "shared"=>false, "shared_agent"=>false, "last_login_at"=>"2018-03-07T19:00:58Z", "two_factor_auth_enabled"=>false, "signature"=>nil, "details"=>nil, "notes"=>nil, "role_type"=>nil, "custom_role_id"=>nil, "moderator"=>false, "ticket_restriction"=>"requested", "only_private_comments"=>false, "restricted_agent"=>true, "suspended"=>false, "chat_only"=>false, "default_group_id"=>nil, "user_fields"=>{}},
I'm getting a wrong arguments error when invoking a scope:
Report.start_driver_time(Unit.find(3007),Driver.find(2),3,2013)
scope :start_driver_time, lambda { |unit, driver, month, year|
where("unit_id = ? AND
driver_id = ? AND
extract(MONTH FROM time) = ? AND
extract(YEAR FROM time) = ?",
unit.id, driver.id, month, year)
.order("time asc")
.min(:time)
}
#select(:time) select([:id, :time])
scope :next_driver_time, lambda {|unit, time|
joins(:alerts => {:alert_code => :alert_unit_codes})
.where("reports.unit_id = ? AND
reports.time >= ? AND
alert_unit_codes.name = ?",
unit.id, time, "Seat Belt OFF")
.min(:time)
}
scope :reports_within_driving_period, lambda { |start_time, end_time|
where("unit_id = ? AND
reports.time >= ? AND
reports.time <= ?",
start_time, end_time)
}
stacktrace:
ArgumentError: wrong number of arguments(1 for 0)
from /Users/johnmerlino/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.5/lib/active_record/relation/delegation.rb:37:in `min'
from /Users/johnmerlino/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.5/lib/active_record/relation/delegation.rb:37:in `method_missing'
from /Users/johnmerlino/Documents/github/XKTrackingSystem/app/models/report.rb:40:in `block in <class:Report>'
from /Users/johnmerlino/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.5/lib/active_record/scoping/named.rb:180:in `call'
from /Users/johnmerlino/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.5/lib/active_record/scoping/named.rb:180:in `block (2 levels) in scope'
from /Users/johnmerlino/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.5/lib/active_record/scoping/default.rb:41:in `block in unscoped'
from /Users/johnmerlino/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.5/lib/active_record/relation.rb:241:in `block in scoping'
from /Users/johnmerlino/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.5/lib/active_record/scoping.rb:98:in `with_scope'
from /Users/johnmerlino/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.5/lib/active_record/relation.rb:241:in `scoping'
from /Users/johnmerlino/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.5/lib/active_record/scoping/default.rb:41:in `unscoped'
from /Users/johnmerlino/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.5/lib/active_record/scoping/named.rb:180:in `block in scope'
from (irb):1
from /Users/johnmerlino/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.5/lib/rails/commands/console.rb:47:in `start'
from /Users/johnmerlino/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.5/lib/rails/commands/console.rb:8:in `start'
from /Users/johnmerlino/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.5/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'1.9.3p0 :002 > exit
I think you intend to use minimum instead of min? I haven't found a reference to min, so it might be using a different method that uses no parameters.
I'm new to rails, and I'm getting an error and I can't seem to find were the problem is. Here is the log:
[32651:ERROR] 2012-10-09 13:46:52 :: comparison of Float with Float failed
[32651:ERROR] 2012-10-09 13:46:52 :: /home/sunny/backend/lib/analytics/lifetime.rb:45:in `each'
/home/sunny/backend/lib/analytics/lifetime.rb:45:in `max'
/home/sunny/backend/lib/analytics/lifetime.rb:45:in `max_growth'
/home/sunny/backend/lib/analytics/lifetime.rb:15:in `run'
/home/sunny/backend/lib/analytics/post_analytics.rb:102:in `lifetime'
/home/sunny/backend/lib/analytics/post_analytics.rb:27:in `run`run'
lib/endpoints/posts/index.rb:65:in `block in response'
lib/endpoints/posts/index.rb:62:in `each'
lib/endpoints/posts/index.rb:62:in `response'
/usr/local/lib/ruby/gems/1.9.1/gems/goliath-1.0.0.beta.1/lib/goliath/api.rb:163:in `call'
/usr/local/lib/ruby/gems/1.9.1/gems/goliath-1.0.0.beta.1/lib/goliath/rack/validation/required_param.rb:43:in `call'
/usr/local/lib/ruby/gems/1.9.1/gems/goliath-1.0.0.beta.1/lib/goliath/rack/params.rb:61:in `block in call'
/usr/local/lib/ruby/gems/1.9.1/gems/goliath-1.0.0.beta.1/lib/goliath/rack/validator.rb:40:in `safely'
/usr/local/lib/ruby/gems/1.9.1/gems/goliath-1.0.0.beta.1/lib/goliath/rack/params.rb:59:in `call'
/usr/local/lib/ruby/gems/1.9.1/gems/goliath-1.0.0.beta.1/lib/goliath/rack/async_middleware.rb:73:in `call'
/usr/local/lib/ruby/gems/1.9.1/gems/rack-1.4.1/lib/rack/content_length.rb:14:in `call'
/usr/local/lib/ruby/gems/1.9.1/gems/async-rack-0.5.1/lib/async_rack/async_callback.rb:114:in `call'
/usr/local/lib/ruby/gems/1.9.1/gems/async-rack-0.5.1/lib/async_rack/async_callback.rb:91:in `block in new'
/usr/local/lib/ruby/gems/1.9.1/gems/goliath-1.0.0.beta.1/lib/goliath/request.rb:163:in `call'
/usr/local/lib/ruby/gems/1.9.1/gems/goliath-1.0.0.beta.1/lib/goliath/request.rb:163:in `block in process'
Whenever I go to the file and find that row, there is no each, and I can't understand where the problem is. Can anyone help? More than a fix, I want to understand the problem.
Here is the file:
class Lifetime
attr_reader :values
GROWTH_CUT_OFF = 0.10
def initialize(engaged_users_values)
#values = engaged_users_values
end
def run
growths = growth(values)
return [0] if growths.uniq.first == 0 || growths.empty?
max_growth = max_growth(growths)
dead_growth = least_growth(growths, max_growth)
time_diff = time_diff(values.last['end_time'],
values.first['end_time'])
return [time_diff] unless dead_growth
dead_loc = growths.index(dead_growth)
dead_value = values[dead_loc]
lifetime(values.first, dead_value)
end
def time_diff(last, first)
in_minutes(parse_time(last)-parse_time(first))
end
def parse_time(time)
DateTime.parse(time)
end
def growth(values)
values.each_cons(2).map do |one, two|
one_value = one['value'].to_f
two_value = two['value']
((two_value-one_value)/(one_value)*100).round(2)
end
end
def max_growth(growths)
growths.max
end
def least_growth(growths, max_growth)
growth_cut = growth_cut(max_growth)
growths.select {|g| g <= growth_cut}.first
end
def growth_cut(max_growth)
max_growth*GROWTH_CUT_OFF
end
def lifetime(first_value, last_value)
first = parse_time(first_value['end_time'])
last = parse_time(last_value['end_time'])
result = last-first
[in_minutes(result)]
end
def in_minutes(time)
time.to_f*24*60
end
end
If one of both Floats is NaN then you get this message. So, prevent the NaN case.
We can give you more info if you post the exact code of the error (the max_growth method)
I am running a method in the background using delayed-job (collectiveideas fork)
The method I am running is shown below, which fetches the price of the isbn:
def update_prices(isbn13)
#amazon = Nokogiri::XML(open("http://www.amazon.com/s/?url=search-alias%3Daps&field-keywords=#{isbn13}"))
price = #amazon.search('span.listprice').first.text.gsub('$', '')
book = Book.find_by_isbn13(isbn13)
book.update_attribute(:amazon_us_price, price)
end
handle_asynchronously :update_prices
Now when I run this, the job is added to the database but encounters an error when running.
The error is quite large, but I think the gist of it comes from the first line:
Job failed to load: uninitialized constant Syck::Syck.
{Job failed to load: uninitialized constant Syck::Syck. Handler: "--- !ruby/struct:Delayed::PerformableMethod
object: &id005 !ruby/object:BooksController
_action_name: show
_config: !omap []
_env: &id001
GATEWAY_INTERFACE: CGI/1.1
PATH_INFO: /books/9780425160985
QUERY_STRING: \"\"
REMOTE_ADDR: 127.0.0.1
REMOTE_HOST: localhost
REQUEST_METHOD: GET
REQUEST_URI: http://localhost:3000/books/9780425160985
SCRIPT_NAME: \"\"
SERVER_NAME: localhost
SERVER_PORT: \"3000\"
SERVER_PROTOCOL: HTTP/1.1
SERVER_SOFTWARE: WEBrick/1.3.1 (Ruby/1.9.2/2010-08-18)
HTTP_HOST: localhost:3000
HTTP_CONNECTION: keep-alive
HTTP_REFERER: http://localhost:3000/books/search?utf8=%E2%9C%93&keywords=hornets+nest&commit=Search
HTTP_ACCEPT: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_6; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.107 Safari/534.13
HTTP_ACCEPT_ENCODING: gzip,deflate,sdch
HTTP_ACCEPT_LANGUAGE: en-US,en;q=0.8
HTTP_ACCEPT_CHARSET: ISO-8859-1,utf-8;q=0.7,*;q=0.3
HTTP_COOKIE: _bookcloud_session=BAh7B0kiD3Nlc3Npb25faWQGOgZFRiIlMTNkZWFlYTdiYjVjN2IzZDAyOTU1MDc1NTc1ZDJlZDBJIhBfY3NyZl90b2tlbgY7AEZJIjFrUHJoT0RlZmZoSzIrSVdFdFJNbGxMckxENEZnMTM1STZuQUJCdHJuak1BPQY7AEY%3D--c2b7958a5461253129b6d363e3d547bd44c83f9d
rack.version:
- 1
- 1
rack.input: !ruby/object:StringIO {}
rack.errors: !ruby/object:IO {}
rack.multithread: false
rack.multiprocess: false
rack.run_once: false
rack.url_scheme: http
HTTP_VERSION: HTTP/1.1
REQUEST_PATH: /
action_dispatch.parameter_filter:
- :password
action_dispatch.secret_token: ab805f7bf1e681785a2ac4813edc43678cbe855682bc7ca9dc5f2116fc892d8ca41466f9bc261ef4ae15ad83c1c38780780d2f6bfe9c00c14abd68542a535400
action_dispatch.remote_ip: !ruby/object:ActionDispatch::RemoteIp::RemoteIpGetter
check_ip_spoofing: true
env: *id001
trusted_proxies: !ruby/regexp /(^127\\.0\\.0\\.1$|^(10|172\\.(1[6-9]|2[0-9]|30|31)|192\\.168)\\.)/i
rack.session: !map:ActionDispatch::Session::AbstractStore::SessionHash
session_id: 13deaea7bb5c7b3d02955075575d2ed0
_csrf_token: kPrhODeffhK2+IWEtRMllLrLD4Fg135I6nABBtrnjMA=
rack.session.options: !map:ActionDispatch::Session::AbstractStore::OptionsHash
:path: /
:domain:
:expire_after:
:secure: false
:httponly: true
:id: 13deaea7bb5c7b3d02955075575d2ed0
rack.request.cookie_string: _bookcloud_session=BAh7B0kiD3Nlc3Npb25faWQGOgZFRiIlMTNkZWFlYTdiYjVjN2IzZDAyOTU1MDc1NTc1ZDJlZDBJIhBfY3NyZl90b2tlbgY7AEZJIjFrUHJoT0RlZmZoSzIrSVdFdFJNbGxMckxENEZnMTM1STZuQUJCdHJuak1BPQY7AEY%3D--c2b7958a5461253129b6d363e3d547bd44c83f9d
rack.request.cookie_hash:
_bookcloud_session: BAh7B0kiD3Nlc3Npb25faWQGOgZFRiIlMTNkZWFlYTdiYjVjN2IzZDAyOTU1MDc1NTc1ZDJlZDBJIhBfY3NyZl90b2tlbgY7AEZJIjFrUHJoT0RlZmZoSzIrSVdFdFJNbGxMckxENEZnMTM1STZuQUJCdHJuak1BPQY7AEY=--c2b7958a5461253129b6d363e3d547bd44c83f9d
action_dispatch.cookies: !map:ActionDispatch::Cookies::CookieJar
_bookcloud_session: BAh7B0kiD3Nlc3Npb25faWQGOgZFRiIlMTNkZWFlYTdiYjVjN2IzZDAyOTU1MDc1NTc1ZDJlZDBJIhBfY3NyZl90b2tlbgY7AEZJIjFrUHJoT0RlZmZoSzIrSVdFdFJNbGxMckxENEZnMTM1STZuQUJCdHJuak1BPQY7AEY=--c2b7958a5461253129b6d363e3d547bd44c83f9d
action_dispatch.request.unsigned_session_cookie:
session_id: 13deaea7bb5c7b3d02955075575d2ed0
_csrf_token: kPrhODeffhK2+IWEtRMllLrLD4Fg135I6nABBtrnjMA=
action_dispatch.request.path_parameters:
:controller: books
:action: show
:isbn13: \"9780425160985\"
action_controller.instance: *id005
action_dispatch.request.content_type:
action_dispatch.request.request_parameters: !map:ActiveSupport::HashWithIndifferentAccess {}
rack.request.query_string: \"\"
rack.request.query_hash: {}
action_dispatch.request.query_parameters: !map:ActiveSupport::HashWithIndifferentAccess {}
action_dispatch.request.parameters: &id002 !map:ActiveSupport::HashWithIndifferentAccess
controller: books
action: show
isbn13: \"9780425160985\"
action_dispatch.request.formats:
- !ruby/object:Mime::Type
string: text/html
symbol: :html
synonyms:
- application/xhtml+xml
_headers:
Content-Type: text/html
_params: *id002
_request: &id003 !ruby/object:ActionDispatch::Request
env: *id001
filtered_parameters:
controller: books
action: show
isbn13: \"9780425160985\"
fullpath: /books/9780425160985
method: GET
request_method: GET
_response: !ruby/object:ActionDispatch::Response
blank: false
block:
body: []
cache_control: {}
cookie: []
etag:
header: {}
length: 0
request: *id003
sending_file: false
status: 200
writer: !ruby/object:Proc {}
_response_body:
_status: 200
action_has_layout: true
author: Patricia Daniels Cornwell
book: !ruby/ActiveRecord:Book
attributes:
isbn13: \"9780425160985\"
title: Hornet's Nest
author: Patricia Daniels Cornwell
price:
created_at: &id004 2011-03-03 10:41:27.757528 Z
updated_at: *id004
amazon_us_price:
id: 38
lookup: !ruby/object:Nokogiri::XML::Document
decorators:
errors: []
node_cache:
- !ruby/object:Nokogiri::XML::Element {}
- !ruby/object:Nokogiri::XML::Element {}
- !ruby/object:Nokogiri::XML::Element {}
lookup_context: !ruby/object:ActionView::LookupContext
details:
:handlers:
- :erb
- :rjs
- :builder
- :rhtml
- :rxml
:formats:
- :html
:locale:
- :en
- :en
details_key:
frozen_formats: false
skip_default_locale: false
view_paths: !seq:ActionView::PathSet
- !ruby/object:ActionView::FileSystemResolver
cached: {}
caching: false
path: /Users/nick/Dropbox/rails/bookcloud/app/views
title: Hornet's Nest
view_context_class:
method_name: :update_prices_without_delay
args:
- \"9780425160985\"
"
/Users/nick/.rvm/gems/ruby-1.9.2-p0#rorticket/gems/delayed_job-2.1.4/lib/delayed/backend/base.rb:81:in `rescue in payload_object'
/Users/nick/.rvm/gems/ruby-1.9.2-p0#rorticket/gems/delayed_job-2.1.4/lib/delayed/backend/base.rb:79:in `payload_object'
/Users/nick/.rvm/gems/ruby-1.9.2-p0#rorticket/gems/delayed_job-2.1.4/lib/delayed/backend/base.rb:87:in `invoke_job'
/Users/nick/.rvm/gems/ruby-1.9.2-p0#rorticket/gems/delayed_job-2.1.4/lib/delayed/worker.rb:120:in `block (2 levels) in run'
/Users/nick/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/timeout.rb:57:in `timeout'
/Users/nick/.rvm/gems/ruby-1.9.2-p0#rorticket/gems/delayed_job-2.1.4/lib/delayed/worker.rb:120:in `block in run'
/Users/nick/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/benchmark.rb:309:in `realtime'
/Users/nick/.rvm/gems/ruby-1.9.2-p0#rorticket/gems/delayed_job-2.1.4/lib/delayed/worker.rb:119:in `run'
/Users/nick/.rvm/gems/ruby-1.9.2-p0#rorticket/gems/delayed_job-2.1.4/lib/delayed/worker.rb:177:in `reserve_and_run_one_job'
/Users/nick/.rvm/gems/ruby-1.9.2-p0#rorticket/gems/delayed_job-2.1.4/lib/delayed/worker.rb:104:in `block in work_off'
/Users/nick/.rvm/gems/ruby-1.9.2-p0#rorticket/gems/delayed_job-2.1.4/lib/delayed/worker.rb:103:in `times'
/Users/nick/.rvm/gems/ruby-1.9.2-p0#rorticket/gems/delayed_job-2.1.4/lib/delayed/worker.rb:103:in `work_off'
/Users/nick/.rvm/gems/ruby-1.9.2-p0#rorticket/gems/delayed_job-2.1.4/lib/delayed/worker.rb:78:in `block (2 levels) in start'
/Users/nick/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/benchmark.rb:309:in `realtime'
/Users/nick/.rvm/gems/ruby-1.9.2-p0#rorticket/gems/delayed_job-2.1.4/lib/delayed/worker.rb:77:in `block in start'
/Users/nick/.rvm/gems/ruby-1.9.2-p0#rorticket/gems/delayed_job-2.1.4/lib/delayed/worker.rb:74:in `loop'
/Users/nick/.rvm/gems/ruby-1.9.2-p0#rorticket/gems/delayed_job-2.1.4/lib/delayed/worker.rb:74:in `start'
/Users/nick/.rvm/gems/ruby-1.9.2-p0#rorticket/gems/delayed_job-2.1.4/lib/delayed/tasks.rb:9:in `block (2 levels) in <top (required)>'
/Users/nick/.rvm/gems/ruby-1.9.2-p0#global/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/Users/nick/.rvm/gems/ruby-1.9.2-p0#global/gems/rake-0.8.7/lib/rake.rb:636:in `block in execute'
/Users/nick/.rvm/gems/ruby-1.9.2-p0#global/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/Users/nick/.rvm/gems/ruby-1.9.2-p0#global/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/Users/nick/.rvm/gems/ruby-1.9.2-p0#global/gems/rake-0.8.7/lib/rake.rb:597:in `block in invoke_with_call_chain'
/Users/nick/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/Users/nick/.rvm/gems/ruby-1.9.2-p0#global/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/Users/nick/.rvm/gems/ruby-1.9.2-p0#global/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/Users/nick/.rvm/gems/ruby-1.9.2-p0#global/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/Users/nick/.rvm/gems/ruby-1.9.2-p0#global/gems/rake-0.8.7/lib/rake.rb:2029:in `block (2 levels) in top_level'
/Users/nick/.rvm/gems/ruby-1.9.2-p0#global/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/Users/nick/.rvm/gems/ruby-1.9.2-p0#global/gems/rake-0.8.7/lib/rake.rb:2029:in `block in top_level'
/Users/nick/.rvm/gems/ruby-1.9.2-p0#global/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Users/nick/.rvm/gems/ruby-1.9.2-p0#global/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/Users/nick/.rvm/gems/ruby-1.9.2-p0#global/gems/rake-0.8.7/lib/rake.rb:2001:in `block in run'
/Users/nick/.rvm/gems/ruby-1.9.2-p0#global/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Users/nick/.rvm/gems/ruby-1.9.2-p0#global/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/Users/nick/.rvm/gems/ruby-1.9.2-p0#global/gems/rake-0.8.7/bin/rake:31:in `<top (required)>'
/Users/nick/.rvm/gems/ruby-1.9.2-p0#global/bin/rake:19:in `load'
/Users/nick/.rvm/gems/ruby-1.9.2-p0#global/bin/rake:19:in `<main>'
Any idea what may be causing the error? I have never heard of Syck before.
Include the following lines of code in boot.rb (config\boot.rb)
require 'yaml'
YAML::ENGINE.yamler= 'syck'
For those that this didn't work for, like me, I've found include the Psych gem to handle YAML parsing fixed the issue. See: Delayed_job: Job failed to load: uninitialized constant Syck::Syck