rails/rails — pull request #5169 by salrepe (2012-02-25 14:57:03+00:00)
Title: Fix Errors#from_array when an attribute name starts like /ActiveResource

When ActiveResource grabs errors from an array of messages, if you have an attribute name compound, that starts like another attribute name, for example:

{:errors => {:phone => "is not valid", :phone_work => "can't be blank" }}

If phone is parsed first it's getting the error of phone_work too.
For this reason, sorting the array of attributes by length we can fix this problem.