This project is archived and is in readonly mode.
Add first and last to OrderedHash
Reported by John | April 9th, 2009 @ 04:36 AM | in 3.x
When we upgraded our app from 2.1 to 2.3 the change in OrderedHash to be based on a hash rather than an array broke some of our code.
This patch adds first and last back onto the ordered hash - just for convenience's sake.
Comments and changes to this ticket
-
Gareth Adams April 15th, 2009 @ 08:58 AM
This is a useful patch, +1
I was planning to open a bug report about OrderedHash#to_a not returning ordered results, maybe this is a better place for it?
-
John April 16th, 2009 @ 12:29 AM
- Tag set to verified
-
John May 12th, 2009 @ 01:48 AM
hey just pinging this ticket, it's been tagged verified for near a month
-
David Trasbo April 14th, 2010 @ 07:40 PM
- Assigned user set to Ryan Bigg
Regular hashes are ordered in Ruby 1.9, so I think this ticket should be marked as "won't fix" - in my opinion it serves no purpose to keep maintaining a piece of functionality that is available in newer versions of Ruby by default.
If people want OrderedHash to behave differently they can patch it on a per-app basis - or just upgrade.
-
Ryan Bigg April 15th, 2010 @ 11:03 AM
- State changed from new to verified
- Assigned user cleared.
If 3 people want a ticket it should be made into Rails unless Core vetos it. NOT marking as invalid, but rather verified so it should get some eyes.
-
Rizwan Reza May 16th, 2010 @ 07:30 PM
- Tag changed from verified to bugmash-review
The patch didn't apply cleanly and also implemented to_a.
The patch attach applies cleanly, passes all tests and only implements first and last, as there is an implementation of to_a there now.
-
Rizwan Reza May 16th, 2010 @ 07:39 PM
- Tag cleared.
- State changed from verified to wontfix
José replied:
OrderedHash behaves like a Hash now to be more close to Ruby 1.9 behavior. Since 1.9 we don't have #first and #last, OrderedHash shouldn't as well.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>