ruby-on-rails – 带导轨的Rspec 3.1给出了DEPRECATION警告不推荐使用ActiveRecord :: Associations :: AssociationCollection?

前端之家收集整理的这篇文章主要介绍了ruby-on-rails – 带导轨的Rspec 3.1给出了DEPRECATION警告不推荐使用ActiveRecord :: Associations :: AssociationCollection?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
升级到rails 3.1,我有一些问题,我的测试现在工作得很好.

在测试之前,我得到以下警告:

DEPRECATION警告:不推荐使用ActiveRecord :: Associations :: AssociationCollection!改用ActiveRecord :: Associations :: CollectionProxy. (来自/home/user/rails_projects/project/config/environment.rb:5)

如何使用CollectionProxy而不是AssociationCollection?

这是我的宝石文件

source 'http://rubygems.org'

gem 'rails','3.1.0'
gem 'jquery-rails'
gem "therubyracer","~> 0.9.4"

gem 'carrierwave','0.5.6'
gem 'haml','~>3.1.2'
gem 'MysqL2','0.3.7'
gem 'rmagick','2.13.1'
gem 'sitemap_generator','2.0.1'
gem 'whenever','0.6.8',:require => false
gem 'will_paginate','3.0.pre2'

group :assets do
  gem 'sass-rails',"  ~> 3.1.0"
  gem 'coffee-rails',"~> 3.1.0"
  gem 'uglifier'
end

group :development do
  gem 'rspec-rails','2.6.1'
  gem 'annotate-models','1.0.4'
  gem 'faker','0.9.5',:require => false
  gem 'ruby-debug19','0.11.6'
end

group :test do
  gem 'rspec-rails','2.6.1'
  gem 'webrat','0.7.3'
  gem 'factory_girl_rails','1.0'
  gem 'spork','~> 0.9.0.rc'
end

这是我的environment.rb:

# Load the rails application
require File.expand_path('../application',__FILE__)

# Initialize the rails application
Project::Application.initialize!

谢谢!

解决方法

我有同样的问题,并通过升级到最新版本的will_paginate来修复它.所以,改变这个:gem’will_paginate’,’3.0.pre2′

到:gem“will_paginate”,“〜> 3.0.2”

保存你的Gemfile然后做捆绑安装.

原文链接:https://www.f2er.com/ruby/270990.html

猜你在找的Ruby相关文章