我試圖從Ruby 1.9.3 to Ruby 2.1.2 (Rails 4.0)
升級。我正在使用RVM。使用RVM升級到Ruby 2.1.2後Paper Trail(paper_trail)錯誤。未初始化的常量PaperTrail :: Rails :: Engine
我安裝了Ruby 2.1.2,更新了Gemfile,包括指定"gem 'paper_trail', '~> 3.0.5'"
,用RVM切換到Ruby 2.1.2,創建了一個新的gemset,並切換到它。
然後我做了一個軟件包安裝。
When I attempt to run rails server, I get the following error:
/Users/sjohnson/my_app/config/initializers/paper_trail.rb:2:in
<top (required)>': uninitialized constant PaperTrail::Rails::Engine (NameError) from /Users/sjohnson/.rvm/gems/[email protected]/gems/zeus-0.13.3/lib/zeus/load_tracking.rb:50:in
load' from /Users/sjohnson/.rvm/gems/[email protected]/gems/zeus-0.13.3/lib/zeus/load_tracking.rb:50:inload' from /Users/sjohnson/.rvm/gems/[email protected]/gems/zeus-0.13.3/lib/zeus/load_tracking.rb:43:in
load' from /Users/sjohnson/.rvm/gems/[email protected]/gems/railties-4.0.5/lib/rails/engine.rb:609:inblock (2 levels) in <class:Engine>' from /Users/sjohnson/.rvm/gems/[email protected]/gems/railties-4.0.5/lib/rails/engine.rb:608:in
each' from /Users/sjohnson/.rvm/gems/[email protected]/gems/railties-4.0.5/lib/rails/engine.rb:608:inblock in <class:Engine>' from /Users/sjohnson/.rvm/gems/[email protected]/gems/railties-4.0.5/lib/rails/initializable.rb:30:in
instance_exec' from /Users/sjohnson/.rvm/gems/[email protected]/gems/railties-4.0.5/lib/rails/initializable.rb:30:inrun' from /Users/sjohnson/.rvm/gems/[email protected]/gems/railties-4.0.5/lib/rails/initializable.rb:55:in
block in run_initializers' from /Users/sjohnson/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:226:inblock in tsort_each' from /Users/sjohnson/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:348:in
block (2 levels) in each_strongly_connected_component' from /Users/sjohnson/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:418:inblock (2 levels) in each_strongly_connected_component_from' from /Users/sjohnson/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:427:in
each_strongly_connected_component_from' from /Users/sjohnson/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:417:inblock in each_strongly_connected_component_from' from /Users/sjohnson/.rvm/gems/[email protected]/gems/railties-4.0.5/lib/rails/initializable.rb:44:in
each' from /Users/sjohnson/.rvm/gems/[email protected]/gems/railties-4.0.5/lib/rails/initializable.rb:44:intsort_each_child' from /Users/sjohnson/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:411:in
call' from /Users/sjohnson/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:411:ineach_strongly_connected_component_from' from /Users/sjohnson/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:347:in
block in each_strongly_connected_component' from /Users/sjohnson/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:345:ineach' from /Users/sjohnson/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:345:in
call' from /Users/sjohnson/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:345:ineach_strongly_connected_component' from /Users/sjohnson/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:224:in
tsort_each' from /Users/sjohnson/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/tsort.rb:205:intsort_each' from /Users/sjohnson/.rvm/gems/[email protected]/gems/railties-4.0.5/lib/rails/initializable.rb:54:in
run_initializers' from /Users/sjohnson/.rvm/gems/[email protected]/gems/railties-4.0.5/lib/rails/application.rb:215:ininitialize!' from /Users/sjohnson/.rvm/gems/[email protected]/gems/railties-4.0.5/lib/rails/railtie/configurable.rb:30:in
method_missing' from /Users/sjohnson/my_app/config/environment.rb:5:in<top (required)>' from /Users/sjohnson/my_app/spec/spec_helper.rb:10:in
require' from /Users/sjohnson/my_app/spec/spec_helper.rb:10:in<top (required)>' from /Users/sjohnson/my_app/spec/api/v1/api_authentication_spec.rb:1:in
require' from /Users/sjohnson/my_app/spec/api/v1/api_authentication_spec.rb:1:in<top (required)>' from /Users/sjohnson/.rvm/gems/[email protected]/gems/rspec-core-3.0.3/lib/rspec/core/configuration.rb:1057:in
load' from /Users/sjohnson/.rvm/gems/[email protected]/gems/rspec-core-3.0.3/lib/rspec/core/configuration.rb:1057:inblock in load_spec_files' from /Users/sjohnson/.rvm/gems/[email protected]/gems/rspec-core-3.0.3/lib/rspec/core/configuration.rb:1057:in
each' from /Users/sjohnson/.rvm/gems/[email protected]/gems/rspec-core-3.0.3/lib/rspec/core/configuration.rb:1057:inload_spec_files' from /Users/sjohnson/.rvm/gems/[email protected]/gems/rspec-core-3.0.3/lib/rspec/core/runner.rb:97:in
setup' from /Users/sjohnson/.rvm/gems/[email protected]/gems/rspec-core-3.0.3/lib/rspec/core/runner.rb:85:inrun' from /Users/sjohnson/.rvm/gems/[email protected]/gems/rspec-core-3.0.3/lib/rspec/core/runner.rb:70:in
run' from /Users/sjohnson/.rvm/gems/[email protected]/gems/rspec-core-3.0.3/lib/rspec/core/runner.rb:38:ininvoke' from /Users/sjohnson/.rvm/gems/[email protected]/gems/rspec-core-3.0.3/exe/rspec:4:in
' from /Users/sjohnson/.rvm/gems/[email protected]/bin/rspec:23:inload' from /Users/sjohnson/.rvm/gems/[email protected]/bin/rspec:23:in
' from /Users/sjohnson/.rvm/gems/[email protected]/bin/ruby_executable_hooks:15:ineval' from /Users/sjohnson/.rvm/gems/[email protected]/bin/ruby_executable_hooks:15:in
'I attempted to run: bundle exec rails generate paper_trail:install
It indicated that the migration file already existed (PaperTrail was working under 1.9.3). So, I ran it again: bundle exec rails generate paper_trail:install -s
It completed successfully, but I have the same issue.
config/initializers/paper_trail.rb:
# the following line is required for PaperTrail >= 3.0.3 with Rails PaperTrail::Rails::Engine.eager_load! module PaperTrail class Version < ActiveRecord::Base attr_accessible :captain end end `
想法?其他信息會有幫助嗎?
編輯: 儘管以paper_trail在初始化文件3.0.3參考,創業板是在3.0.5版本(如通過做寶石列表驗證)。錯誤跟蹤中對3.0.3的引用是針對Rspec的。
他們已經將paper_trail版本更新爲3.0.5,並通過此常量解析刪除了版本3.0.3。 我只是在我的初始化做 '模塊PaperTrail' '模塊Rails' '類引擎<::滑軌:: Engine' '路徑[ '應用程序/模型'] <<「的lib/paper_trail /框架/ active_record/models'' 'end' 'end' 'end' – 2014-09-08 08:45:30
我將代碼添加到了我的初始值設定項中,而且似乎正在工作。如果您輸入這些信息作爲答案,而不是評論,我可以接受。謝謝。 – SamuelLJohnson 2014-09-08 15:30:37