我試圖在rails版本中安裝devise,我得到的錯誤是devise的最新版本
。我試著用其他devise版本,但它被更新到了最新的版本,
這是錯誤的:
我試著用其他devise版本,但它被更新到了最新的版本。
這是一個錯誤:
這是一個錯誤。
/usr/local/bundle/gems/devise-4.8.0/lib/devise. rb:321:in `ref': undefined method `reference' for ActiveSupport::Dependencies:Module (NoMethodError)
web_1 | from /usr/local/bundle/gems/devise-4.8.0/lib/devise.rb:340:in `mailer='.
web_1 | from /usr/local/bundle/gems/devise-4.8.0/lib/devise.rb:342:in `<module: Devise> '
web_1 |來自/usr/local/bundle/gems/devise-4.8.0/lib/devise。 rb:11:in `< main> '
web_1 | from /usr/local/bundle/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
web_1 |來自/usr/local/bundle/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
web_1 | from /usr/local/bundle/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register' 。
web_1 |來自/usr/local/bundle/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require。 rb:22:in `require_with_bootsnap_lfi'
web_1 | from /usr/local/bundle/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
web_1 | from /usr/local/bundle/gems/zeitwerk-2.5.0.beta3/lib/zeitwerk/kernel.rb:35:in `require'.
web_1 | from /usr/local/lib/ruby/3.0.0/bundler/runtime.rb:66:in `block(2級) in require'
web_1 |來自/usr/local/lib/ruby/3.0.0/bundler/runtime。 rb:61:in `each'
web_1 | from /usr/local/lib/ruby/3.0.0/bundler/runtime.rb:61:in `block in require'
web_1 | from /usr/local/lib/ruby/3.0.0/bundler/runtime.rb:50:in `each'.
web_1 | from /usr/local/lib/ruby/3.0.0/bundler/runtime.rb:50:in `require'
web_1 |來自/usr/local/lib/ruby/3.0.0/bundler。 rb:174:in `require'
如果你能幫助我,我將非常感激
uj5u.com熱心網友回復:
錯誤的來源
你所使用的Devise版本呼叫了一個名為reference的方法。
https://github.com/heartcombo/devise/blob/c82e4cf47b02002b2fd7ca31d441cf1043fc634c/lib/devise.rb#L320-L323
def self.ref(arg)
ActiveSupport::Dependencies.reference(arg)
Getter.new(arg)
結束。
該方法存在于Rails 6中。 https://github.com/rails/rails/blob/6-0-stable/activesupport/lib/active_support/dependencies.rb#L651-L653
在Rails 7中已被洗掉。 https://github.com/rails/rails/blob/main/activesupport/lib/active_support/dependencies.rb
Rails 7.0.0.alpha1 更新日志中的這句話解釋了。
ActiveSupport::Dependencies 的私有內部類已被洗掉,如 ActiveSupport::Dependencies::Reference、ActiveSupport::Dependencies::Blamable 和其他。
選項
等待 Devise 發布與 Rails 7 兼容的版本,或者將 Devise 與之前的 Rails 版本一起使用。uj5u.com熱心網友回復:
這個修正修復了我的錯誤:
gem "devise", github: "strobilomyces/devise", branch: "patch-1"
https://github.com/heartcombo/devise/pull/5397
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/322762.html
標籤:
