Migrating from ruby 1.9.3 to ruby 2.0.0

Since support for ruby 1.9.3 is suppose to end in 2015, it was high time I migrate from ruby 1.9.3 to ruby 2.0.0, and eventually to ruby 2.2.0. These are the steps I followed while migrating to ruby 2.0.0 and the problems I faced.

1. bundle install for ruby 2.0.0

2. run test cases.
Few test cases failed. The error message was:

  private method `initialize_dup' called at line:.. in file ....

When I looked at the line which was producing this error, it was


It turns out this problem was fixed in Rails 3.2.13. So I upgraded the Rails version to 3.2.13. If you want to read more about, here is the github issue page.

3. Bumped up Rails to 3.2.13 in Gemfile.
4. bundle install again.

Rails locked at 3.1.11

So, did

bundle update rails

And, another error: devise_invitable(0.6.0) depends on Rails >= 3.0.0 and = 3.0.0 and < 4.0 .

So came step 5.
5. Bumped devise_invitable to 1.0.0 in Gemfile.


bundle update devise_invitable.

7. Another error: devise_invitable depends on devise ~ 2.0

I was on a much lower version of devise. So I upgraded devise to 2.0.0 in Gemfile.


bundle update devise

Another error popped up, devise 2.0.0 depends on railties ~3.1 and I had rails pointed to 3.2.13. Now growing with frustation, I did:

bundle update

and upgraded the whole stack and no error.. boom ..!!

9. Run test cases again and the previous test cases which were failing, passed, but new ones failed now. The error was:


When I did `bundle update`, it updated paperclip to 4.2.0 and in this version, in your model you need to mention the content_type and file_name validation of the file or explicitly mention that you do not need these validations. This is how you can do it all:

validates_attachment_content_type :image, :content_type =&gt; [&quot;image/jpg&quot;, &quot;image/jpeg&quot;, &quot;image/png&quot;, &quot;image/gif&quot;]
validates_attachment_file_name :avatar, :matches =&gt; [/png\Z/, /jpe?g\Z/, /gif\Z/]


do_not_validate_attachment_file_type :image

You can read about it more on this stackoverflow thread.

10. So I changed my models accordingly.
11. ran test cases again and boom.. all test cases passing..!!

And finally rails server starts. But this does not mean I will not face any problems henceforth because I have 78% test coverage and this means there is considerable chunk of code which is not checked yet, this means a day of manual testing awaits me..!!

I will keep updating this post with new steps and problems I am facing. But until then,

12. Manual labour .. !!!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s