从rails 3.2升级到rails 4.2之前的测试套件
我最近试图将我的Rails应用程序从Rails 3.2更新到Rails 4.2。 在升级之前,我所有的测试套件都能正常运行,但更新之后,我收到了一些奇怪的东西。 每次我尝试运行测试时都会发生同样的错误
rake db:fixtures:load --trace ** Invoke db:fixtures:load (first_time) ** Invoke environment (first_time) ** Execute environment ** Invoke db:load_config (first_time) ** Execute db:load_config ** Execute db:fixtures:load rake aborted! NameError: uninitialized constant ActiveRecord::FixtureSet::RenderContext::MassiveMessage (erb):11:in `get_binding' /home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/erb.rb:863:in `eval' /home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/erb.rb:863:in `result' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixture_set/file.rb:42:in `render' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixture_set/file.rb:33:in `rows' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixture_set/file.rb:24:in `each' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:758:in `block (2 levels) in read_fixture_files' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixture_set/file.rb:15:in `open' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:757:in `block in read_fixture_files' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:756:in `each' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:756:in `each_with_object' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:756:in `read_fixture_files' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:592:in `initialize' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:514:in `new' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:514:in `block (2 levels) in create_fixtures' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:511:in `map' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:511:in `block in create_fixtures' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:282:in `disable_referential_integrity' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:508:in `create_fixtures' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/railties/databases.rake:203:in `block (3 levels) in ' /home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/task.rb:240:in `call' /home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/task.rb:240:in `block in execute' /home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/task.rb:235:in `each' /home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/task.rb:235:in `execute' /home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/task.rb:179:in `block in invoke_with_call_chain' /home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize' /home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/task.rb:172:in `invoke_with_call_chain' /home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/task.rb:165:in `invoke' /home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:150:in `invoke_task' /home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:106:in `block (2 levels) in top_level' /home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:106:in `each' /home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:106:in `block in top_level' /home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:115:in `run_with_threads' /home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:100:in `top_level' /home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:78:in `block in run' /home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:176:in `standard_exception_handling' /home/alexander/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rake/application.rb:75:in `run' /home/alexander/.rvm/rubies/ruby-2.2.0/bin/rake:33:in `'
谁能帮我这个?
删除后,我得到另一个错误见
rake aborted! TypeError: no implicit conversion of Fixnum into String /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:636:in `gsub' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:636:in `block (2 levels) in table_rows' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:635:in `each' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:635:in `block in table_rows' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:623:in `each' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:623:in `map' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:623:in `table_rows' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:526:in `block (3 levels) in create_fixtures' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:524:in `each' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:524:in `block (2 levels) in create_fixtures' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/transaction.rb:188:in `within_new_transaction' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:523:in `block in create_fixtures' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:282:in `disable_referential_integrity' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/fixtures.rb:508:in `create_fixtures' /home/alexander/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/railties/databases.rake:203:in `block (3 levels) in ' Tasks: TOP => db:fixtures:load (See full trace by running task with --trace)
:(我做了渐进式更新从轨3.2到4.02,然后从4.02到4.1,所有工作顺利,然后在轨4.2我得到了同样的错误
我将这个问题发布在rails仓库的github上,他们回答我这是一个bug,将在4.2.1版本发布
目前你可以纠正这个问题。 行[关键] = value.gsub( “$ LABEL”标签。to_s)如果value.is_a?(String)在从ActiveRecord的库文件fixture.rb 636线
链接地址: http://www.djcxy.com/p/49943.html