Forum: Ruby on Rails Another "escaping" problem

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
7cafdbe9f20d97ff4c21340707018d51?d=identicon&s=25 Elan Feingold (elan)
on 2006-02-19 11:11
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
7cafdbe9f20d97ff4c21340707018d51?d=identicon&s=25 Elan Feingold (elan)
on 2006-02-20 01:32
Found it....geeze. In one of my models I'd overridden Hash and Array's
to_s method to return "inspect"

class Array
7cafdbe9f20d97ff4c21340707018d51?d=identicon&s=25 Elan Feingold (elan)
on 2006-02-20 01:33
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
This topic is locked and can not be replied to.