Another "escaping" problem


#1

Ruby 1.8.2, edge Rails (and 1.0), Mac OS X 10.4.3.

Here’s the SQL that gets generated for an eager load:

SELECT events.id AS t1_r0, events.user_id AS t1_r1, addresses.id
AS t0_r0, events.name AS t1_r2, addresses.name AS t0_r1,
events.meet_at AS t1_r3, addresses.phone_number AS t0_r2,
events.created_at AS t1_r4, addresses.phone_service AS t0_r3,
events.location_id AS t1_r5, addresses.user_id AS t0_r4 FROM
addresses [" LEFT OUTER JOIN addresses_events ON
addresses_events.address_id = addresses.id LEFT OUTER JOIN events ON
addresses_events.event_id = events.id "]WHERE (addresses.phone_number
= ‘6129641828’ )

Notice the bit in the middle that looks like a list of strings ["…"].

Any clues?

Thanks,

-elan


#2

Found it…geeze. In one of my models I’d overridden Hash and Array’s
to_s method to return “inspect”

class Array


#3

Found it…geeze. In one of my models I’d overridden Hash and Array’s
to_s method to return “inspect” a la:

class Array
def to_s
inspect
end
end

Silly me, I did it for debugging purposes but never realized it would
have a wider impact.

-elan