I can confirm that this does not happen with ruby 1.8.6 on my machine.
I don't have ruby 1.9 installed, so I can't be much help beyond that.
Here are my respective outputs with ruby 1.8.6, just as you'd expect:
>> [1,String,'foo',ActiveRecord::Base].collect {|a,b| puts [a,b].inspect}
[1, nil]
[String, nil]
["foo", nil]
[ActiveRecord::Base, nil]
=> [nil, nil, nil, nil]
>> [1,String,'foo',ActiveRecord::Base].collect {|a| puts [a].inspect}
[1]
[String]
["foo"]
[ActiveRecord::Base]
=> [nil, nil, nil, nil]
On Jul 14, 11:13 am, Niels Ganser <[email protected]> wrote:
> Hey everyone.
>
> My mind has been boggled by an issue I ran into a few hours ago. I am
> completely lost as to why the following code behaves the way it does
> and would appreciate any hints from you guys. It would already be
> super-helpful if others could post their output for the following so
> that I can figure out whether this is weirdness specific to my setup
> or a global phenomenon.
>
> So far, ActiveRecord::Base and its descendants are the only classes
> with which I see this behaviour and furthermore it seems to be limited
> to Ruby 1.9.1.
>
> Mayday!
>
> Thanks,
> Niels (about to dig into array.c)
>
> $ ruby --version; rails --version; ruby <<EOR
> require "rubygems"
> gem "activerecord"
> require "activerecord"
>
> puts "\nActiveRecord::Base disappears:"
> [1,String,'foo',ActiveRecord::Base].collect {|a,b| puts [a,b].inspect}
>
> puts "\nActiveRecord::Base stays:"
> [1,String,'foo',ActiveRecord::Base].collect {|a| puts [a].inspect}
>
> puts "\nwtf?"
>
> EOR
> ruby 1.9.1p129 (2009-05-12 revision 23412) [x86_64-linux]
> Rails 2.3.2
>
> ActiveRecord::Base disappears:
> [1, nil]
> [String, nil]
> ["foo", nil]
> [nil, nil]
>
> ActiveRecord::Base stays:
> [1]
> [String]
> ["foo"]
> [ActiveRecord::Base]
>
> wtf?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---