Skip to content

Instantly share code, notes, and snippets.

@djo
Created December 4, 2012 10:54
Show Gist options
  • Save djo/4202644 to your computer and use it in GitHub Desktop.
Save djo/4202644 to your computer and use it in GitHub Desktop.
Upgrade to 1.9 notes

Upgrade "the second project" to ruby 1.9 notes

Gems

Keep in mind that not all gems (versions) support a needed ruby version.

  • Remove 1.8 gems: rcov, ruby-debug
  • Add 1.9 gems: debugger

Try 'bundle install'.

Encoding

In ruby 1.9 you should add encoding manually:

# encoding: UTF-8

CSV

  • Remove 'fastercsv' gem from the dependencies becasue of it's a part of the standard libraries now.
  • Use 'CSV.generate' instead of 'CSV::Writer.generate'

Differences in syntax

  • Use 'then' in Case "when 'expected' then 'result'" instead of "when 'expected': 'result'"
  • Hash notation with comma are not supported: { key, value }

Array building

:to_s works as :inspect now:

1.8.7 :001 > ['1','2','3'].to_s
 => "123"

1.9.3-p286-perf :001 > ['1','2','3'].to_s
 => "[\"1\", \"2\", \"3\"]"

So, replace your custom message buildings:

entry.errors[:column]

with:

entry.errors[:column].join(', ')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment