Switching my Rails 3.2.12 project to Ruby 2.0.0 fails test

Switching my Rails 3.2.12 project to Ruby 2.0.0 does not pass the test:

NoMethodError: private method `initialize_dup' called for #<Receipt:0x007fe06c809428> 

It looks like initialize_dup now a private method.

What can I do to get my tests pass using Rails 3.2.12 and Ruby 2.0.0?

+4
source share
2 answers

For those who are concerned about upgrading to 3.2.13 due to some problems that may arise, I added this to the initialization file:

 # Because of the Ruby 2.0 privatizes the method and Rails 3.2.12 use of it # , and because Rails 3.2.13 (which has a fix) also could potentially # introduce other bugs, we're adding this patch to fix the issue. # # Remove this if the project contains Rails >= 3.2.13 module ActiveModel class Errors public :initialize_dup end module Validations public :initialize_dup end end class ActiveRecord::Base public :initialize_dup end 
+12
source

It was released using Ruby 2.0.0 with Rails 3.2.13.rc2, and also fixed the above initialize_dup problem in this release and a few more fixes.

http://weblog.rubyonrails.org/2013/3/7/Rails-3-2-13-rc2-has-been-released/

This works for me.

+2
source

All Articles