TypeError (без явного преобразования nil в String) - PullRequest
0 голосов
/ 14 апреля 2020

Я внедряю некоторые изменения в серверное приложение heroku, работающее ruby 2.5, в локальной среде все идет хорошо, но сервер отвечает 500 с ошибкой TypeError (no implicit conversion of nil into String) на каждый запрос после аутентификации:

2020-04-14T16:37:41.998777+00:00 app[web.1]: I, [2020-04-14T16:37:41.998693 #12]  INFO -- : [bd78978d-7a55-458c-a239-55f082b3eec9] Started GET "/v1/admin/stores?page=1&ignore_pagination=false" for 189.102.184.22 at 2020-04-14 16:37:41 +0000
2020-04-14T16:37:42.003544+00:00 app[web.1]: I, [2020-04-14T16:37:42.003454 #12]  INFO -- : [bd78978d-7a55-458c-a239-55f082b3eec9] Processing by V1::Admins::StoresController#index as JSON
2020-04-14T16:37:42.004172+00:00 app[web.1]: I, [2020-04-14T16:37:42.004087 #12]  INFO -- : [bd78978d-7a55-458c-a239-55f082b3eec9]   Parameters: {"page"=>"1", "ignore_pagination"=>"false"}
2020-04-14T16:37:42.005520+00:00 app[web.1]: I, [2020-04-14T16:37:42.005424 #12]  INFO -- : [bd78978d-7a55-458c-a239-55f082b3eec9] Completed 500 Internal Server Error in 1ms
2020-04-14T16:37:42.027748+00:00 app[web.1]: F, [2020-04-14T16:37:42.027590 #12] FATAL -- : [bd78978d-7a55-458c-a239-55f082b3eec9]   
2020-04-14T16:37:42.027832+00:00 app[web.1]: F, [2020-04-14T16:37:42.027735 #12] FATAL -- : [bd78978d-7a55-458c-a239-55f082b3eec9] TypeError (no implicit conversion of nil into String):
2020-04-14T16:37:42.027900+00:00 app[web.1]: F, [2020-04-14T16:37:42.027830 #12] FATAL -- : [bd78978d-7a55-458c-a239-55f082b3eec9]   
2020-04-14T16:37:42.028083+00:00 app[web.1]: F, [2020-04-14T16:37:42.027947 #12] FATAL -- : [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/jwt-2.2.1/lib/jwt/algos/hmac.rb:14:in `digest'
2020-04-14T16:37:42.028084+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/jwt-2.2.1/lib/jwt/algos/hmac.rb:14:in `sign'
2020-04-14T16:37:42.028085+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/jwt-2.2.1/lib/jwt/algos/hmac.rb:28:in `verify'
2020-04-14T16:37:42.028085+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/jwt-2.2.1/lib/jwt/signature.rb:44:in `verify'
2020-04-14T16:37:42.028086+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/jwt-2.2.1/lib/jwt/decode.rb:42:in `verify_signature'
2020-04-14T16:37:42.028086+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/jwt-2.2.1/lib/jwt/decode.rb:26:in `decode_segments'
2020-04-14T16:37:42.028087+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/jwt-2.2.1/lib/jwt.rb:28:in `decode'
2020-04-14T16:37:42.028087+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/warden-jwt_auth-0.3.6/lib/warden/jwt_auth/token_decoder.rb:17:in `call'
2020-04-14T16:37:42.028088+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/warden-jwt_auth-0.3.6/lib/warden/jwt_auth/user_decoder.rb:33:in `call'
2020-04-14T16:37:42.028088+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/warden-jwt_auth-0.3.6/lib/warden/jwt_auth/strategy.rb:22:in `authenticate!'
2020-04-14T16:37:42.028089+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/warden-1.2.8/lib/warden/strategies/base.rb:54:in `_run!'
2020-04-14T16:37:42.028089+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/warden-1.2.8/lib/warden/proxy.rb:369:in `block in _run_strategies_for'
2020-04-14T16:37:42.028090+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/warden-1.2.8/lib/warden/proxy.rb:365:in `each'
2020-04-14T16:37:42.028090+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/warden-1.2.8/lib/warden/proxy.rb:365:in `_run_strategies_for'
2020-04-14T16:37:42.028091+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/warden-1.2.8/lib/warden/proxy.rb:335:in `_perform_authentication'
2020-04-14T16:37:42.028091+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/warden-1.2.8/lib/warden/proxy.rb:133:in `authenticate!'
2020-04-14T16:37:42.028092+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/devise-4.5.0/lib/devise/controllers/helpers.rb:118:in `authenticate_admin!'
2020-04-14T16:37:42.028092+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.2/lib/active_support/callbacks.rb:426:in `block in make_lambda'
2020-04-14T16:37:42.028093+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.2/lib/active_support/callbacks.rb:198:in `block (2 levels) in halting'
2020-04-14T16:37:42.028093+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.4.2/lib/abstract_controller/callbacks.rb:34:in `block (2 levels) in <module:Callbacks>'
2020-04-14T16:37:42.028093+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.2/lib/active_support/callbacks.rb:199:in `block in halting'
2020-04-14T16:37:42.028094+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.2/lib/active_support/callbacks.rb:513:in `block in invoke_before'
2020-04-14T16:37:42.028094+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.2/lib/active_support/callbacks.rb:513:in `each'
2020-04-14T16:37:42.028095+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.2/lib/active_support/callbacks.rb:513:in `invoke_before'
2020-04-14T16:37:42.028095+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.2/lib/active_support/callbacks.rb:131:in `run_callbacks'
2020-04-14T16:37:42.028095+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.4.2/lib/abstract_controller/callbacks.rb:41:in `process_action'
2020-04-14T16:37:42.028096+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.4.2/lib/action_controller/metal/rescue.rb:22:in `process_action'
2020-04-14T16:37:42.028096+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.4.2/lib/action_controller/metal/instrumentation.rb:34:in `block in process_action'
2020-04-14T16:37:42.028096+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.2/lib/active_support/notifications.rb:168:in `block in instrument'
2020-04-14T16:37:42.028118+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.2/lib/active_support/notifications/instrumenter.rb:23:in `instrument'
2020-04-14T16:37:42.028118+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.2/lib/active_support/notifications.rb:168:in `instrument'
2020-04-14T16:37:42.028128+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.4.2/lib/action_controller/metal/instrumentation.rb:32:in `process_action'
2020-04-14T16:37:42.028129+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.4.2/lib/action_controller/metal/params_wrapper.rb:256:in `process_action'
2020-04-14T16:37:42.028129+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.4.2/lib/active_record/railties/controller_runtime.rb:24:in `process_action'
2020-04-14T16:37:42.028130+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.4.2/lib/abstract_controller/base.rb:134:in `process'
2020-04-14T16:37:42.028130+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.4.2/lib/action_controller/metal.rb:191:in `dispatch'
2020-04-14T16:37:42.028130+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.4.2/lib/action_controller/metal.rb:252:in `dispatch'
2020-04-14T16:37:42.028131+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.4.2/lib/action_dispatch/routing/route_set.rb:52:in `dispatch'
2020-04-14T16:37:42.028131+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.4.2/lib/action_dispatch/routing/route_set.rb:34:in `serve'
2020-04-14T16:37:42.028131+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.4.2/lib/action_dispatch/journey/router.rb:52:in `block in serve'
2020-04-14T16:37:42.028132+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.4.2/lib/action_dispatch/journey/router.rb:35:in `each'
2020-04-14T16:37:42.028132+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.4.2/lib/action_dispatch/journey/router.rb:35:in `serve'
2020-04-14T16:37:42.028133+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.4.2/lib/action_dispatch/routing/route_set.rb:840:in `call'
2020-04-14T16:37:42.028133+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/newrelic_rpm-6.10.0.364/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
2020-04-14T16:37:42.028133+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/rack-attack-6.2.2/lib/rack/attack.rb:156:in `call'
2020-04-14T16:37:42.028134+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/newrelic_rpm-6.10.0.364/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
2020-04-14T16:37:42.028134+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/rack-attack-6.2.2/lib/rack/attack.rb:170:in `call'
2020-04-14T16:37:42.028134+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/newrelic_rpm-6.10.0.364/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
2020-04-14T16:37:42.028135+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/warden-jwt_auth-0.3.6/lib/warden/jwt_auth/middleware/token_dispatcher.rb:20:in `call'
2020-04-14T16:37:42.028135+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/newrelic_rpm-6.10.0.364/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
2020-04-14T16:37:42.028135+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/warden-jwt_auth-0.3.6/lib/warden/jwt_auth/middleware/revocation_manager.rb:21:in `call'
2020-04-14T16:37:42.028136+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/newrelic_rpm-6.10.0.364/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
2020-04-14T16:37:42.028136+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/rack-2.2.2/lib/rack/builder.rb:244:in `call'
2020-04-14T16:37:42.028136+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/warden-jwt_auth-0.3.6/lib/warden/jwt_auth/middleware.rb:23:in `call'
2020-04-14T16:37:42.028137+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/newrelic_rpm-6.10.0.364/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
2020-04-14T16:37:42.028137+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/newrelic_rpm-6.10.0.364/lib/new_relic/rack/agent_hooks.rb:30:in `traced_call'
2020-04-14T16:37:42.028143+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/newrelic_rpm-6.10.0.364/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
2020-04-14T16:37:42.028143+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/newrelic_rpm-6.10.0.364/lib/new_relic/rack/browser_monitoring.rb:33:in `traced_call'
2020-04-14T16:37:42.028143+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/newrelic_rpm-6.10.0.364/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
2020-04-14T16:37:42.028144+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/warden-1.2.8/lib/warden/manager.rb:36:in `block in call'
2020-04-14T16:37:42.028144+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/warden-1.2.8/lib/warden/manager.rb:34:in `catch'
2020-04-14T16:37:42.028145+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/warden-1.2.8/lib/warden/manager.rb:34:in `call'
2020-04-14T16:37:42.028145+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/newrelic_rpm-6.10.0.364/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
2020-04-14T16:37:42.028145+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/rack-2.2.2/lib/rack/etag.rb:27:in `call'
2020-04-14T16:37:42.028146+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/newrelic_rpm-6.10.0.364/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
2020-04-14T16:37:42.028146+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/rack-2.2.2/lib/rack/conditional_get.rb:27:in `call'
2020-04-14T16:37:42.028146+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/newrelic_rpm-6.10.0.364/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
2020-04-14T16:37:42.028147+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/rack-2.2.2/lib/rack/head.rb:12:in `call'
2020-04-14T16:37:42.028147+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/newrelic_rpm-6.10.0.364/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
2020-04-14T16:37:42.028147+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.4.2/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
2020-04-14T16:37:42.028148+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.2/lib/active_support/callbacks.rb:98:in `run_callbacks'
2020-04-14T16:37:42.028148+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.4.2/lib/action_dispatch/middleware/callbacks.rb:26:in `call'
2020-04-14T16:37:42.028148+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/newrelic_rpm-6.10.0.364/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
2020-04-14T16:37:42.028149+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.4.2/lib/action_dispatch/middleware/debug_exceptions.rb:61:in `call'
2020-04-14T16:37:42.028149+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/newrelic_rpm-6.10.0.364/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
2020-04-14T16:37:42.028149+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.4.2/lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
2020-04-14T16:37:42.028149+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/newrelic_rpm-6.10.0.364/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
2020-04-14T16:37:42.028150+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/railties-5.2.4.2/lib/rails/rack/logger.rb:38:in `call_app'
2020-04-14T16:37:42.028150+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/railties-5.2.4.2/lib/rails/rack/logger.rb:26:in `block in call'
2020-04-14T16:37:42.028151+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.2/lib/active_support/tagged_logging.rb:71:in `block in tagged'
2020-04-14T16:37:42.028151+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.2/lib/active_support/tagged_logging.rb:28:in `tagged'
2020-04-14T16:37:42.028152+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.2/lib/active_support/tagged_logging.rb:71:in `tagged'
2020-04-14T16:37:42.028152+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/railties-5.2.4.2/lib/rails/rack/logger.rb:26:in `call'
2020-04-14T16:37:42.028152+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/newrelic_rpm-6.10.0.364/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
2020-04-14T16:37:42.028156+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.4.2/lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
2020-04-14T16:37:42.028157+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/newrelic_rpm-6.10.0.364/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
2020-04-14T16:37:42.028157+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.4.2/lib/action_dispatch/middleware/request_id.rb:27:in `call'
2020-04-14T16:37:42.028158+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/newrelic_rpm-6.10.0.364/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
2020-04-14T16:37:42.028158+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/rack-2.2.2/lib/rack/runtime.rb:22:in `call'
2020-04-14T16:37:42.028158+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/newrelic_rpm-6.10.0.364/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
2020-04-14T16:37:42.028159+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.4.2/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
2020-04-14T16:37:42.028159+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/newrelic_rpm-6.10.0.364/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
2020-04-14T16:37:42.028160+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.4.2/lib/action_dispatch/middleware/executor.rb:14:in `call'
2020-04-14T16:37:42.028160+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/newrelic_rpm-6.10.0.364/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
2020-04-14T16:37:42.028161+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.4.2/lib/action_dispatch/middleware/static.rb:127:in `call'
2020-04-14T16:37:42.028161+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/newrelic_rpm-6.10.0.364/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
2020-04-14T16:37:42.028161+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/rack-2.2.2/lib/rack/sendfile.rb:110:in `call'
2020-04-14T16:37:42.028162+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/newrelic_rpm-6.10.0.364/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
2020-04-14T16:37:42.028162+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/rack-timeout-0.6.0/lib/rack/timeout/core.rb:151:in `block in call'
2020-04-14T16:37:42.028163+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/rack-timeout-0.6.0/lib/rack/timeout/support/timeout.rb:19:in `timeout'
2020-04-14T16:37:42.028163+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/rack-timeout-0.6.0/lib/rack/timeout/core.rb:150:in `call'
2020-04-14T16:37:42.028163+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/newrelic_rpm-6.10.0.364/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
2020-04-14T16:37:42.028164+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/rack-cors-1.1.1/lib/rack/cors.rb:100:in `call'
2020-04-14T16:37:42.028164+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/newrelic_rpm-6.10.0.364/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
2020-04-14T16:37:42.028164+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/railties-5.2.4.2/lib/rails/engine.rb:524:in `call'
2020-04-14T16:37:42.028165+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/newrelic_rpm-6.10.0.364/lib/new_relic/agent/instrumentation/middleware_tracing.rb:99:in `call'
2020-04-14T16:37:42.028165+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/puma-3.12.4/lib/puma/configuration.rb:227:in `call'
2020-04-14T16:37:42.028166+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/puma-3.12.4/lib/puma/server.rb:675:in `handle_request'
2020-04-14T16:37:42.028166+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/puma-3.12.4/lib/puma/server.rb:476:in `process_client'
2020-04-14T16:37:42.028166+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/puma-3.12.4/lib/puma/server.rb:334:in `block in run'
2020-04-14T16:37:42.028167+00:00 app[web.1]: [bd78978d-7a55-458c-a239-55f082b3eec9] vendor/bundle/ruby/2.5.0/gems/puma-3.12.4/lib/puma/thread_pool.rb:135:in `block in spawn_thread'

Этот контроллер, например, такой:

# frozen_string_literal: true

module V1
  module Admins
    class StoresController < BaseController
      def index
        render json: StoreSerializer.serialize(Store.all, page: current_page)
      end

      def show
        @store = Store.find(params[:id])
        render json: StoreSerializer.serialize(@store, schema: :store_info), status: :ok
      rescue ActiveRecord::RecordNotFound => e
        render json: { error: e.message }, status: :not_found
      end

      def create
        @store = Store.create!(permited_params)
        render json: StoreSerializer.serialize(@store, schema: :store_info), status: :ok
      rescue ActiveRecord::RecordInvalid => e
        render json: { error: e.message }, status: :unprocessable_entity
      end

      def update
        @store = Store.find(params[:id])
        @store.update(permited_params)
        @store.save
        render json: StoreSerializer.serialize(@store, schema: :store_info), status: :ok
      rescue ActiveRecord::RecordNotFound => e
        render json: { error: e.message }, status: :not_found
      end

      def destroy
        @store = Store.find(params[:id])

        @store.destroy

        render json: StoreSerializer.serialize(@store)
      rescue ActiveRecord::RecordNotFound => e
        render json: { error: e.message }, status: :not_found
      end

      private

      def permited_params
        params.permit(:name, :category, :email, :phone_number,
                      :address, :district, :postal_code, :city,
                      :state, :cnpj, :sige_code, :status,
                      :is_kipling)
      end
    end
  end
end

И его модель:

# frozen_string_literal: true

class Store < ApplicationRecord
  CATEGORY = %w[wholesale retail].freeze
  STATUS = %w[active inactive].freeze

  enum status: %i[inactive active]
  enum category: %i[wholesale retail]

  # Relationships
  has_many :traders, dependent: :restrict_with_exception
  has_many :marketing_resources, as: :owner, dependent: :destroy
  has_many :store_suppliers, dependent: :restrict_with_exception
  has_many :suppliers, through: :store_suppliers
  has_many :request_support_materials, as: :request_owner, dependent: :destroy

  # Validations and Normalizations
  normalize :cnpj, :phone_number, :postal_code, with: :remove_punctuation

  validates :id, uniqueness: true
  validates :name, :category, :address, :city, :state, :status, presence: true
  validates :phone_number, length: { is: 11 }, allow_nil: true
  validates :postal_code, length: { is: 8 }
  validates :cnpj, :sige_code, presence: true, uniqueness: true
  validates :status, inclusion: { in: STATUS }, allow_nil: false
  validates :category, inclusion: { in: CATEGORY }, allow_nil: false
  validates :state, inclusion: { in: Constants::STATES }
  validate :cnpj_valid?, if: proc { |c| c.cnpj.present? }

  def cnpj_valid?
    errors.add(:cnpj, :invalid) unless CNPJ.new(cnpj).valid?
  end
end

Я учусь ruby и точно не знаю Какую информацию мне нужно опубликовать, чтобы помочь вам, ребята, помогите мне, так что просто спросите меня, что нужно. Заранее спасибо!

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