Rails - ActiveRecord错误 - ActiveRecord ::委托#map委托给to_a.map,但是to_a是nil

时间:2017-02-10 13:01:07

标签: ruby-on-rails ruby activerecord

我正在运行一个旧应用程序(rails 4.0.0)它完美运行,直到我尝试升级boostrap-sass(获取Bootstrap 3)。在尝试解决它创建的错误时,我被这个错误所停止(locahost:3000和rake db:migrate输出):

已编辑:添加了输出跟踪错误

/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activesupport-4.0.0/lib/active_support/values/time_zone.rb:282: warning: circular argument reference - now
[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.
rake aborted!
ActiveRecord::Delegation#map delegated to to_a.map, but to_a is nil: #<ActiveRecord::Relation [#<ActiveRecord::SchemaMigration version: "20130819195603">, #<ActiveRecord::SchemaMigration version: "20130820164509">, #<ActiveRecord::SchemaMigration version: "20130821200951">, #<ActiveRecord::SchemaMigration version: "20130822213538">, #<ActiveRecord::SchemaMigration version: "20130911184108">, #<ActiveRecord::SchemaMigration version: "20130912181426">, #<ActiveRecord::SchemaMigration version: "20130912181823">, #<ActiveRecord::SchemaMigration version: "20130912182059">, #<ActiveRecord::SchemaMigration version: "20130912190809">, #<ActiveRecord::SchemaMigration version: "20130912235118">, ...]>
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activerecord-4.0.0/lib/active_record/relation/delegation.rb:16:in `rescue in map'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activerecord-4.0.0/lib/active_record/relation/delegation.rb:12:in `map'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:787:in `get_all_versions'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:949:in `migrated'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:954:in `ran?'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:931:in `block in runnable'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:931:in `reject'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:931:in `runnable'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:908:in `migrate'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:764:in `up'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:742:in `migrate'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activerecord-4.0.0/lib/active_record/railties/databases.rake:42:in `block (2 levels) in <top (required)>'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `call'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `block in execute'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `each'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `execute'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/task.rb:194:in `block in invoke_with_call_chain'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/task.rb:187:in `invoke_with_call_chain'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/task.rb:180:in `invoke'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:152:in `invoke_task'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:108:in `block (2 levels) in top_level'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:108:in `each'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:108:in `block in top_level'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:117:in `run_with_threads'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:102:in `top_level'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:80:in `block in run'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:178:in `standard_exception_handling'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:77:in `run'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
/Users/MYUSER/.rbenv/versions/2.2.0/bin/rake:23:in `load'
/Users/MYUSER/.rbenv/versions/2.2.0/bin/rake:23:in `<main>'
NoMethodError: undefined method `synchronize' for #<Module:0x007fd400988a10>             
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/validates_timeliness-4.0.2/lib/validates_timeliness/orm/active_record.rb:43:in `block in define_attribute_methods'
    /Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/validates_timeliness-4.0.2/lib/validates_timeliness/orm/active_record.rb:42:in `tap'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/validates_timeliness-4.0.2/lib/validates_timeliness/orm/active_record.rb:42:in `define_attribute_methods'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activerecord-4.0.0/lib/active_record/attribute_methods.rb:167:in `respond_to?'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activesupport-4.0.0/lib/active_support/callbacks.rb:368:in `__define_callbacks'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activesupport-4.0.0/lib/active_support/callbacks.rb:79:in `run_callbacks'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activerecord-4.0.0/lib/active_record/core.rb:216:in `init_with'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activerecord-4.0.0/lib/active_record/persistence.rb:55:in `instantiate'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activerecord-4.0.0/lib/active_record/querying.rb:45:in `block in find_by_sql'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activerecord-4.0.0/lib/active_record/result.rb:21:in `block in each'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activerecord-4.0.0/lib/active_record/result.rb:21:in `each'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activerecord-4.0.0/lib/active_record/result.rb:21:in `each'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activerecord-4.0.0/lib/active_record/querying.rb:45:in `map'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activerecord-4.0.0/lib/active_record/querying.rb:45:in `find_by_sql'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activerecord-4.0.0/lib/active_record/relation.rb:585:in `exec_queries'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activerecord-4.0.0/lib/active_record/relation.rb:471:in `load'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activerecord-4.0.0/lib/active_record/relation.rb:220:in `to_a'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activerecord-4.0.0/lib/active_record/relation/delegation.rb:12:in `map'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:787:in `get_all_versions'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:949:in `migrated'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:954:in `ran?'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:931:in `block in runnable'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:931:in `reject'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:931:in `runnable'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:908:in `migrate'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:764:in `up'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activerecord-4.0.0/lib/active_record/migration.rb:742:in `migrate'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/activerecord-4.0.0/lib/active_record/railties/databases.rake:42:in `block (2 levels) in <top (required)>'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `call'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `block in execute'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `each'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `execute'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/task.rb:194:in `block in invoke_with_call_chain'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/task.rb:187:in `invoke_with_call_chain'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/task.rb:180:in `invoke'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:152:in `invoke_task'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:108:in `block (2 levels) in top_level'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:108:in `each'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:108:in `block in top_level'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:117:in `run_with_threads'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:102:in `top_level'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:80:in `block in run'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:178:in `standard_exception_handling'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rake-12.0.0/lib/rake/application.rb:77:in `run'
/Users/MYUSER/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
/Users/MYUSER/.rbenv/versions/2.2.0/bin/rake:23:in `load'
/Users/MYUSER/.rbenv/versions/2.2.0/bin/rake:23:in `<main>'

任务:TOP =&gt;分贝:迁移

我的Gemfile如下:

source 'https://rubygems.org'

gem 'rails', '4.0.0'

gem 'devise', '3.1.1'
gem 'devise_invitable', '1.3.2'
gem 'responders', '1.0.0'
gem 'simple_form', '~> 3.0.0.rc'
gem 'mail_form', :git => 'https://github.com/plataformatec/mail_form.git', :branch => 'v1.5.0.rc'
gem 'cancan'
gem 'validates_timeliness'
gem 'money-rails', '0.8.1'
gem 'flexslider'
gem "google_currency"

gem 'rdstation-ruby-client'

# database

gem 'mysql2', '0.3.18'
gem 'foreigner'
gem 'activerecord-import', '0.5.0'

# Translate

gem 'globalize', '4.0.0'

# image

gem 'carrierwave'
gem 'jquery-fileupload-rails'
gem 'rmagick'

# assets
gem 'sass-rails'
gem 'uglifier'
gem 'therubyracer', '0.12.0', platforms: :ruby
gem 'jquery-rails'
gem 'jquery-ui-rails'
gem 'bootstrap-sass', '2.3.2.2'
gem "font-awesome-rails", '3.2.1.3'

# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks

gem 'turbolinks', '1.3.0'

# deploy

gem 'capistrano', '~> 2.15.5'
gem 'capistrano-ext', '~> 1.2.1'

gem 'paypal-express'

#used for moip

gem 'builder'
gem 'httparty','0.13.7'

# Paginate

gem 'will_paginate', '3.0.5'

# Search Filter

gem'ransack'


group :development do
  gem 'pry'
  gem 'pry-nav'
  gem 'launchy'
  gem 'better_errors'
  gem 'binding_of_caller'
end

group :test do
  gem 'cucumber-rails'
  gem 'database_cleaner'
  gem 'factory_girl'
  gem 'selenium-webdriver'
  gem 'capybara-webkit'
  gem 'rspec-rails'
end

Error returned by locahost:3000

我必须运行哪些验证来识别和解决问题?

0 个答案:

没有答案