Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

AssociationProxy undef methods call =~ on symbol in Ruby 1.9

#4513

Not sure this can technically count as a bug, since on a stock Ruby 1.9.x the behavior is the same as on 1.8.x, but due to an obscure bug that showed up at http://github.com/ernie/meta_where/issues#issue/1 I tracked down something interesting in AssociationProxy. Since Ruby 1.9 returns symbols in response to Object#methods instead of strings, association_proxy.rb is calling regexps on symbols while undefining methods.

The default behavior on 1.9 is to cast a symbol to string before comparing via regexp, so this issue is masked unless you attempt to do something crazy, like, oh, say, defining a new Symbol#=~, in which case it causes the association proxy to fail to mask the class of an association to be Array, then cascades to the problem outlined in the above github ticket, where the check for association.is_a?(Array) fails in form_helper.rb (fields_for_with_nested_attributes).

A patch is attached. If a test is warranted on this one just let me know and I'm sure I can come up with something. :)

Reported by Ernie Miller · April 30th, 2010 @ 08:51 PM

State: resolved
Milestone: none
Assigned to: Pratik Pratik
Importance: Low