This project is archived and is in readonly mode.
Bug In #method_missing For AssociationCollection's Dynamic #create_by_ For 1.8.6
Reported by Ken Collins | July 23rd, 2010 @ 09:04 PM
While using RVM to test an old ruby 1.8.6-p388 on our production servers, I noticed that the create_by_ dynamic method blows up due to how Hash[] args are processed. For instance,
1.8.6
>> Hash[[["post_id", 42], ["skimmer", false]]]
ArgumentError: odd number of arguments for Hash
from (irb):14:in `[]'
from (irb):14
1.8.7 & Up
>> Hash[[["post_id", 42], ["skimmer", false]]]
=> {"post_id"=>42, "skimmer"=>false}
The attached patch is not pretty, but it does work the same for all ruby versions. Thoughts on how to make this cleaner? The patch is applied against 2-3-stable and tested under 1.8.6/1.8.7/1.9.1. BTW, there are no tests in this because 4 tests already failed as a result of this.
Comments and changes to this ticket
-
Ken Collins September 1st, 2010 @ 03:54 PM
- Tag changed from ruby 1.8.6, 1.8.6, 2-3-stable to ruby 1.8.6, 1.8.6, 2-3-stable, 2.3.9
There tests are still failing and with 2.3.9 around the corner, should this really be fixed soon?
-
Ken Collins September 1st, 2010 @ 04:16 PM
Here is another patch that fix this and other paren warnings too.
-
Michael Koziarski September 3rd, 2010 @ 03:41 AM
- State changed from new to committed
- Importance changed from to Low
applied!
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>