我执行了捆绑更新,将导轨版本从3.2.13
更改为3.2.17
,更新了其他一些宝石,并将设计版本从1.5.0
更改为3.2.3
}
我修复了一些Devise过时的方法和不兼容性,并遇到以下错误:uninitialized constant Users (NameError)
源自devise_for :users
config/routes.rb
路由助手
[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.
/home/vagrant/.rbenv/versions/1.9.3-p484/lib/ruby/gems/1.9.1/gems/activesupport-3.2.17/lib/active_support/inflector/methods.rb:230:in `block in constantize': uninitialized constant Users (NameError)
from /home/vagrant/.rbenv/versions/1.9.3-p484/lib/ruby/gems/1.9.1/gems/activesupport-3.2.17/lib/active_support/inflector/methods.rb:229:in `each'
from /home/vagrant/.rbenv/versions/1.9.3-p484/lib/ruby/gems/1.9.1/gems/activesupport-3.2.17/lib/active_support/inflector/methods.rb:229:in `constantize'
from /home/vagrant/.rbenv/versions/1.9.3-p484/lib/ruby/gems/1.9.1/gems/devise-3.2.3/lib/devise.rb:297:in `get'
from /home/vagrant/.rbenv/versions/1.9.3-p484/lib/ruby/gems/1.9.1/gems/devise-3.2.3/lib/devise/mapping.rb:77:in `to'
from /home/vagrant/.rbenv/versions/1.9.3-p484/lib/ruby/gems/1.9.1/gems/devise-3.2.3/lib/devise/mapping.rb:72:in `modules'
from /home/vagrant/.rbenv/versions/1.9.3-p484/lib/ruby/gems/1.9.1/gems/devise-3.2.3/lib/devise/mapping.rb:89:in `routes'
from /home/vagrant/.rbenv/versions/1.9.3-p484/lib/ruby/gems/1.9.1/gems/devise-3.2.3/lib/devise/mapping.rb:156:in `default_used_route'
from /home/vagrant/.rbenv/versions/1.9.3-p484/lib/ruby/gems/1.9.1/gems/devise-3.2.3/lib/devise/mapping.rb:66:in `initialize'
from /home/vagrant/.rbenv/versions/1.9.3-p484/lib/ruby/gems/1.9.1/gems/devise-3.2.3/lib/devise.rb:331:in `new'
from /home/vagrant/.rbenv/versions/1.9.3-p484/lib/ruby/gems/1.9.1/gems/devise-3.2.3/lib/devise.rb:331:in `add_mapping'
from /home/vagrant/.rbenv/versions/1.9.3-p484/lib/ruby/gems/1.9.1/gems/devise-3.2.3/lib/devise/rails/routes.rb:221:in `block in devise_for'
from /home/vagrant/.rbenv/versions/1.9.3-p484/lib/ruby/gems/1.9.1/gems/devise-3.2.3/lib/devise/rails/routes.rb:220:in `each'
from /home/vagrant/.rbenv/versions/1.9.3-p484/lib/ruby/gems/1.9.1/gems/devise-3.2.3/lib/devise/rails/routes.rb:220:in `devise_for'
from /var/wannafun/scade-backend/config/routes.rb:10:in `block in <top (required)>'
如何解决?
更新1
我修复了rails并将版本分别设计为3.2.13
和1.5.0
,然后捆绑更新(更新了许多gems)并仍然得到相同的错误。我想devise和active_support宝石都是无辜的。
正如我在Gemfile.lock中看到的,active_support依赖于两个完全独立的gem:
activesupport (3.2.13)
i18n (= 0.6.1)
multi_json (~> 1.0)
虽然Devise取决于以下宝石:
devise (1.5.0)
bcrypt-ruby (~> 3.0)
orm_adapter (~> 0.0.3)
warden (~> 1.1)
rack (>= 1.0)
无法想象他们中的哪一个出了什么问题
答案 0 :(得分:0)
我开始逐个修复宝石版本,并且在我修复了 checker gem的版本后发现错误消失了。在我修复检查器版本之后bundle show
的差异输出:
30c30
< * checker (0.6.6)
---
> * checker (0.6.2)
所以我最终从我的Gemfile中删除了检查器。
不幸的是,我没有时间调查检查程序影响设计或active_support gems功能的方式。也许以后。
我想问题是在CoreExt.constantize方法中,它覆盖(?)ActiveSupport :: Inflector的相同方法