Puma 发现了这个错误:使用弹性搜索服务的 nil:NilClass (NoMethodError) 的未定义方法 `first'。
当记录更新然后这个问题
ruby-2.7.2/rails-6.0.3.4/gems/activerecord-6.0.3.4/lib/active_record/associations/preloader/association.rb:105:in block in records_for' ruby-2.7.2/rails-6.0.3.4/gems/activerecord-6.0.3.4/lib/active_record/core.rb:361:in
init_with_attributes' ruby-2.7.2/rails-6.0.3.4/gems /activerecord-6.0.3.4/lib/active_record/persistence.rb:403:in instantiate_instance_of' ruby-2.7.2/rails-6.0.3.4/gems/activerecord-6.0.3.4/lib/active_record/querying.rb:61:in
block (2 levels) in find_by_sql' ruby-2.7.2/rails-6.0.3.4/gems/activerecord-6.0.3.4/lib/active_record/ result.rb:62:in block in each' ruby-2.7.2/rails-6.0.3.4/gems/activerecord-6.0.3.4/lib/active_record/result.rb:62:in
each' ruby-2.7.2/rails-6.0.3.4/gems/activerecord-6.0.3.4/lib/active_record/result.rb:62:in each' ruby-2.7.2/rails-6.0.3.4/gems/activerecord-6.0.3.4/lib/active_record/querying.rb:61:in
map' ruby-2.7.2/rails- 6.0.3.4/gems/activerecord-6.0.3.4/lib/active_record/querying.rb:61:in block in find_by_sql' ruby-2.7.2/rails-6.0.3.4/gems/activesupport-6.0.3.4/lib/active_support/notifications/instrumenter.rb:24:in
instrument' ruby-2.7.2/rails-6.0.3.4/gems/activerecord-6.0.3.4/lib/active_record/querying .rb:56:infind_by_sql' ruby-2.7.2/rails-6.0.3.4/gems/activerecord-6.0.3.4/lib/active_record/relation.rb:821:in
块在 exec_queries 的 ruby-2.7.2/rails-6.0.3.4/gems/activerecord-6.0.3.4/lib/active_record/relation.rb:839:inskip_query_cache_if_necessary' ruby-2.7.2/rails-6.0.3.4/gems/activerecord-6.0.3.4/lib/active_record/relation.rb:808:in
exec_queries' ruby-2.7.2/rails-6.0.3.4/gems/activerecord-6.0.3.4/lib/active_record/relation.rb:626:in load' ruby-2.7.2/rails-6.0.3.4/gems/activerecord-6.0.3.4/lib/active_record/associations/preloader/association.rb:102:in
records_for' ruby-2.7.2/rails-6.0.3.4/gems/activerecord -6.0.3.4/lib/active_record/associations/preloader/association.rb:41:in preloaded_records' ruby-2.7.2/rails-6.0.3.4/gems/activerecord-6.0.3.4/lib/active_record/associations/preloader/association.rb:32:in
records_by_owner' ruby-2.7.2/rails-6.0.3.4/gems/activerecord-6.0.3.4/lib/active_record/associations/preloader/ Association.rb:18:in block in run' ruby-2.7.2/rails-6.0.3.4/gems/activerecord-6.0.3.4/lib/active_record/associations/preloader/association.rb:17:in
each' ruby-2.7.2/rails-6.0.3.4/gems/activerecord-6.0.3.4/lib/active_record/associations/preloader/association.rb:17:in run' ruby-2.7.2/rails-6.0.3.4/gems/activerecord-6.0.3.4/lib/active_record/associations/preloader.rb:145:in
block in preloaders_for_reflection' ruby - 2.7.2/rails-6.0.3.4/gems/activerecord-6.0.3.4/lib/active_record/associations/preloader.rb:144:in each' ruby-2.7.2/rails-6.0.3.4/gems/activerecord-6.0.3.4/lib/active_record/associations/preloader.rb:144:in
map' ruby-2.7.2/rails-6.0.3.4/gems/activerecord-6.0 .3.4/lib/active_record/associations/preloader.rb:144:inpreloaders_for_reflection' ruby-2.7.2/rails-6.0.3.4/gems/activerecord-6.0.3.4/lib/active_record/associations/preloader.rb:113:in
preloaders_for_hash' ruby-2.7.2/rails-6.0.3.4/gems/activerecord-6.0.3.4/lib/active_record/associations/preloader.rb:112:in each' ruby-2.7.2/rails-6.0.3.4/gems/activerecord-6.0.3.4/lib/active_record/associations/preloader.rb:112:in
flat_map' ruby -2.7.2/rails 中的块(2 级) -6.0.3.4/gems/activerecord-6.0.3.4/lib/active_record/associations/preloader.rb:112:in block in preloaders_for_hash' ruby-2.7.2/rails-6.0.3.4/gems/activerecord-6.0.3.4/lib/active_record/associations/preloader.rb:111:in
each' ruby-2.7.2/rails-6.0.3.4/gems/activerecord-6.0.3.4/lib/ active_record/associations/preloader.rb:111:in flat_map' ruby-2.7.2/rails-6.0.3.4/gems/activerecord-6.0.3.4/lib/active_record/associations/preloader.rb:111:in
preloaders_for_hash' ruby-2.7.2/rails-6.0.3.4/gems/activerecord-6.0.3.4/lib/active_record/associations/preloader.rb:102:in preloaders_on' ruby-2.7.2/rails-6.0.3.4/gems/activerecord-6.0.3.4/lib/active_record/associations/preloader.rb:92:in
block in preload' ruby-2.7.2/rails-6.0.3.4/gems/activerecord-6.0.3.4/lib/active_record/associations/preloader.rb:91:in each' ruby-2.7.2/rails-6.0.3.4/gems/activerecord-6.0.3.4/lib/active_record/associations/preloader.rb:91:in
flat_map' ruby-2.7.2/rails-6.0.3.4/gems/activerecord -6.0.3.4/lib/active_record/associations/preloader.rb:91:inpreload' ruby-2.7.2/rails-6.0.3.4/gems/activerecord-6.0.3.4/lib/active_record/relation.rb:745:in
在 preload_associations 的 ruby-2.7.2/rails-6.0.3.4/gems/activerecord-6.0.3.4/lib/active_record/relation.rb:743 中的块:在each' ruby-2.7.2/rails-6.0.3.4/gems/activerecord-6.0.3.4/lib/active_record/relation.rb:743:in
preload_associations 的 ruby-2.7.2/rails-6.0.3.4/gems /activerecord-6.0.3.4/lib/active_record/relation.rb:824:in block in exec_queries' ruby-2.7.2/rails-6.0.3.4/gems/activerecord-6.0.3.4/lib/active_record/relation.rb:839:in
skip_query_cache_if_necessary' ruby-2.7.2/rails-6.0.3.4/gems/activerecord-6.0.3.4/lib/active_record/relation.rb:808:在exec_queries' ruby-2.7.2/rails-6.0.3.4/gems/activerecord-6.0.3.4/lib/active_record/relation.rb:626:in
加载'ruby-2.7.2/rails-6.0.3.4/gems/activerecord-6.0.3.4/lib/active_record/relation.rb:250:in records' ruby-2.7.2/rails-6.0.3.4/gems/activerecord-6.0.3.4/lib/active_record/relation/delegation.rb:87:in
each'ruby-2.7.2/rails-6.0.3.4/bundler/ gems/chewy-c91c6842b3e4/lib/chewy/type/adapter/orm.rb:129:in block in import_objects' ruby-2.7.2/rails-6.0.3.4/bundler/gems/chewy-c91c6842b3e4/lib/chewy/type/adapter/orm.rb:119:in
each' ruby-2.7.2/rails-6.0.3.4/bundler/gems/chewy-c91c6842b3e4/lib/chewy/type/adapter /orm.rb:119:in each_slice' ruby-2.7.2/rails-6.0.3.4/bundler/gems/chewy-c91c6842b3e4/lib/chewy/type/adapter/orm.rb:119:in
each' ruby-2.7.2/rails-6.0.3.4/bundler/gems/chewy-c91c6842b3e4/lib/chewy/type/adapter/orm.rb:119:inmap' ruby-2.7.2/rails-6.0.3.4/bundler/gems/chewy-c91c6842b3e4/lib/chewy/type/adapter/orm.rb:119:in
import_objects' ruby-2.7.2/rails-6.0.3.4/bundler/gems/chewy-c91c6842b3e4/lib/chewy/type/adapter/orm.rb:81:in import' ruby-2.7.2/rails-6.0.3.4/bundler/gems/chewy-c91c6842b3e4/lib/chewy/type/import.rb:142:in
block in import_linear' ruby-2.7.2/rails-6.0 .3.4/gems/activesupport-6.0.3.4/lib/active_support/notifications.rb:180:inblock in instrument' ruby-2.7.2/rails-6.0.3.4/gems/activesupport-6.0.3.4/lib/active_support/notifications/instrumenter.rb:24:in
仪器'ruby-2.7.2/rails-6.0.3.4/gems/activesupport-6.0.3.4/lib/active_support/notifications。 rb:180:in instrument' ruby-2.7.2/rails-6.0.3.4/bundler/gems/chewy-c91c6842b3e4/lib/chewy/type/import.rb:141:in
import_linear'ruby-2.7.2/rails-6.0.3.4/bundler/gems/chewy-c91c6842b3e4/lib/chewy/type/import.rb:136:in import_routine' ruby-2.7.2/rails-6.0.3.4/bundler/gems/chewy-c91c6842b3e4/lib/chewy/type/import.rb:87:in
import!' ruby-2.7.2/rails-6.0.3.4/bundler/gems/chewy-c91c6842b3e4/lib/chewy/strategy/atomic.rb:25:in block in leave' ruby-2.7.2/rails-6.0.3.4/bundler/gems/chewy-c91c6842b3e4/lib/chewy/strategy/atomic.rb:25:in
each' ruby-2.7.2/rails-6.0.3.4/bundler/gems /chewy-c91c6842b3e4/lib/chewy/strategy/atomic.rb:25:in all?' ruby-2.7.2/rails-6.0.3.4/bundler/gems/chewy-c91c6842b3e4/lib/chewy/strategy/atomic.rb:25:in
leave' ruby-2.7.2/rails-6.0.3.4/bundler/gems/chewy-c91c6842b3e4/lib/chewy/strategy.rb:63:在tap' ruby-2.7.2/rails-6.0.3.4/bundler/gems/chewy-c91c6842b3e4/lib/chewy/strategy.rb:63:in
pop' ruby-2.7.2/rails-6.0.3.4/bundler/gems/chewy-c91c6842b3e4/lib/chewy/strategy.rb:72:in wrap' ruby-2.7.2/rails-6.0.3.4/bundler/gems/chewy-c91c6842b3e4/lib/chewy.rb:201:in
strategy' ruby-2.7.2/rails-6.0.3.4/bundler/gems /chewy-c91c6842b3e4/lib/chewy/railtie.rb:19:in call' ruby-2.7.2/rails-6.0.3.4/gems/railties-6.0.3.4/lib/rails/rack/logger.rb:37:in
call_app' ruby-2.7.2/rails-6.0.3.4/gems/railties-6.0.3.4/lib/rails/rack/logger.rb:26:在block in call' ruby-2.7.2/rails-6.0.3.4/gems/activesupport-6.0.3.4/lib/active_support/tagged_logging.rb:80:in
标记'ruby-2.7.2/rails-6.0.3.4/gems/activesupport-6.0.3.4/lib/active_support/tagged_logging.rb:28:intagged' ruby-2.7.2/rails-6.0.3.4/gems/activesupport-6.0.3.4/lib/active_support/tagged_logging.rb:80:in
标记'ruby-2.7.2/rails-6.0.3.4/中的块中gems/railties-6.0.3.4/lib/rails/rack/logger.rb:26:in call' ruby-2.7.2/rails-6.0.3.4/gems/sprockets-rails-3.2.2/lib/sprockets/rails/quiet_assets.rb:13:in
call' ruby-2.7.2/rails-6.0.3.4/gems/actionpack-6.0.3.4/lib/action_dispatch/middleware/remote_ip .rb:81:in call' ruby-2.7.2/rails-6.0.3.4/gems/actionpack-6.0.3.4/lib/action_dispatch/middleware/request_id.rb:27:in
call' ruby-2.7.2/rails-6.0.3.4/gems/rack-2.2.3/lib/rack/method_override.rb:24:incall' ruby-2.7.2/rails-6.0.3.4/gems/rack-2.2.3/lib/rack/runtime.rb:22:in
调用'ruby-2.7.2/rails-6.0.3.4/gems/activesupport-6.0.3.4/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in call'ruby call' ruby-2.7.2/rails-6.0.3.4/gems/actionpack-6.0.3.4/lib/action_dispatch/middleware/executor.rb:14:in
-2.7.2/rails-6.0.3.4 /gems/actionpack-6.0.3.4/lib/action_dispatch/middleware/static.rb:126:in call' ruby-2.7.2/rails-6.0.3.4/gems/rack-2.2.3/lib/rack/sendfile.rb:110:in
call' ruby-2.7.2/rails-6.0.3.4/gems/actionpack-6.0.3.4/lib/action_dispatch/middleware/ host_authorization.rb:82:in call' ruby-2.7.2/rails-6.0.3.4/gems/webpacker-5.2.1/lib/webpacker/dev_server_proxy.rb:25:in
perform_request' ruby-2.7.2/rails-6.0.3.4/gems/rack-proxy-0.6.5/lib/rack/proxy.rb:57:in call' ruby-2.7.2/rails-6.0.3.4/gems/railties-6.0.3.4/lib/rails/engine.rb:527:in
call' ruby-2.7.2/ rails-6.0.3.4/gems/puma-5.1.0/lib/puma/configuration.rb:246:in call' ruby-2.7.2/rails-6.0.3.4/gems/puma-5.1.0/lib/puma/request.rb:76:in
block in handle_request' ruby-2.7.2/rails-6.0.3.4/gems/puma-5.1.0/lib /puma/thread_pool.rb:337:in with_force_shutdown' ruby-2.7.2/rails-6.0.3.4/gems/puma-5.1.0/lib/puma/request.rb:75:in
handle_request' ruby-2.7.2/rails-6.0.3.4/gems/puma-5.1.0/lib/puma/server.rb:431:in process_client' ruby-2.7.2/rails-6.0.3.4/gems/puma-5.1.0/lib/puma/thread_pool.rb:145:in
block in spawn_thread'