

本番環境のrubyを`2.6`から`2.7`にバージョンアップしようとしています。  
一気にgemをupdateせず、circleciを使用してlintとrspecがこける都度、該当のgemをupdateすることをエラーが起きなくなるまで繰り返すというような変更作業を行なっています。

その中で以下のエラーを解決できずにいます。

[code]

    LoadError: Unable to autoload constant CaseReports::FavoritesAPI, expected /home/circleci/***/app/api/web/case_reports/favorites_api.rb to define it
    /home/circleci/***/vendor/bundle/ruby/2.7.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:511:in `load_missing_constant'
    /home/circleci/***/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/active_support.rb:60:in `block in load_missing_constant'
    /home/circleci/***/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/active_support.rb:16:in `allow_bootsnap_retry'
    /home/circleci/***/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/active_support.rb:59:in `load_missing_constant'
    /home/circleci/***/vendor/bundle/ruby/2.7.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:195:in `const_missing'
    /home/circleci/***/app/api/app/v2.rb:13:in `<class:V2>'
    /home/circleci/***/app/api/app/v2.rb:1:in `<main>'
    /home/circleci/***/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
    /home/circleci/***/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
    /home/circleci/***/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
    /home/circleci/***/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
    /home/circleci/***/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
    /home/circleci/***/vendor/bundle/ruby/2.7.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `block in require'
    /home/circleci/***/vendor/bundle/ruby/2.7.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:257:in `load_dependency'
    /home/circleci/***/vendor/bundle/ruby/2.7.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `require'
    /home/circleci/***/vendor/bundle/ruby/2.7.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:378:in `block in require_or_load'
    /home/circleci/***/vendor/bundle/ruby/2.7.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:37:in `block in load_interlock'
    /home/circleci/***/vendor/bundle/ruby/2.7.0/gems/activesupport-5.2.2/lib/active_support/dependencies/interlock.rb:14:in `block in loading'
    /home/circleci/***/vendor/bundle/ruby/2.7.0/gems/activesupport-5.2.2/lib/active_support/concurrency/share_lock.rb:151:in `exclusive'
    /home/circleci/***/vendor/bundle/ruby/2.7.0/gems/activesupport-5.2.2/lib/active_support/dependencies/interlock.rb:13:in `loading'
    
[/code]

エラー箇所は`app/api/app/v2.rb`内ですが、これまで本番アプリケーションでも`App::V2::CaseReports::FavoritesAPI`として動作しておりましたが、update作業の中で定数がうまく読まれないようになったようです。

[code]

    # v2.rb
    .
    .
    .
      mount App::V2::BannersAPI
      mount App::V2::BlockingsAPI
      mount App::V2::CaseReports::FavoritesAPI
      mount App::V2::CaseReports::ClipAPI
      mount App::V2::CaseReportsAPI
      mount App::V2::ClinicGroupsAPI
    .
    .
    .
    
[/code]

どなたか知恵を貸しいただけませんでしょうか。  
update作業の概要を以下にまとめておきます。

* * *

  * circleciで用いるimageを`ruby:2.6.0-node-browsers`から`ruby:2.7.0-node-browsers`に変更

[code]

    lint:
        working_directory: ~/***
        resource_class: large
        docker:
          - image: circleci/ruby:2.7.0-node-browsers
    
[/code]

  * エラーの原因となっているgemをupdate 
    * update bundler
    * update bootsnap
    * update shoulda-matchers
    * update config
    * update capybara
    * update grape ← ここから先に進めないです


CC BY-SA 4.0
2020-02-09T11:08:42.563
62906
2020-02-09T11:08:42.563
37774
question
ruby-on-rails ruby docker circleci
ruby2.7へのupdateの際、LoadErrorが起きる