Question about some changes from Ruby 1.8.6 to Ruby 1.9

So, the bulk of my issues thus far have been pretty simple and I’ve
isolated and ported over a very lengthy app from 1.8.6 to 1.9.1.

The biggest issues I saw were things like scopes:

Before:

named_scope :private_pages,
:conditions => ‘pages.parent_id IS NULL and pages.subpage_id IS NULL’,
:order => ‘pages.position’,
:include => {:subpages, :subofsubs}

After:

named_scope :private_pages,
:conditions => ‘pages.parent_id IS NULL and pages.subpage_id IS NULL’,
:order => ‘pages.position’,
:include => [:subpages, :subofsubs]

… and also the use of string.to_a in much of my code

Before: new_array += val.strip).to_a
After: new_array += Array(val.strip)

So, where can I find a solid page or two on a complete list rundown of
all changes from 1.8.6/1.8.7 to 1.9.x? I would like to keep a reference
somewhere handy.

On Jan 18, 2010, at 5:15 PM, Alpha B. wrote:

:conditions => ‘pages.parent_id IS NULL and pages.subpage_id IS NULL’,
:order => ‘pages.position’,
:include => [:subpages, :subofsubs]

Those two :include options are not equivalent. You want:

:include => {:subpages => :subofsubs}

for the Ruby 1.9 version to be equivalent to the 1.8 version.

Gary W.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs