Question about some changes from Ruby 1.8.6 to Ruby 1.9

A

Alpha Blue

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',
:eek:rder => 'pages.position',
:include => {:subpages, :subofsubs}

After:

named_scope :private_pages,
:conditions => 'pages.parent_id IS NULL and pages.subpage_id IS NULL',
:eek:rder => '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.
 
G

Gary Wright

Before:

named_scope :private_pages,
:conditions => 'pages.parent_id IS NULL and pages.subpage_id IS NULL',
:eek:rder => 'pages.position',
:include => {:subpages, :subofsubs}

After:

named_scope :private_pages,
:conditions => 'pages.parent_id IS NULL and pages.subpage_id IS NULL',
:eek:rder => '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 Wright
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top