Forum: Ruby on Rails has_many finder_sql #{id} single/double quotes voodoo

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.
81194a50c0f9bd95d7832a77fdf371bd?d=identicon&s=25 CSN (Guest)
on 2006-02-13 04:07
(Received via mailing list)
I never would have figured this out in many moons:

  has_many :subscribers, :class_name => "Person",
:finder_sql =>
      'SELECT DISTINCT people.* ' +
      'FROM people p, post_subscriptions ps ' +
      'WHERE ps.post_id = #{id} AND ps.person_id =
p.id ' +
      'ORDER BY p.first_name'

Variable interpolation in *single* quotes? Putting it
in double quotes results in a really high number
(541239078 vs. 15 in my case). Is this explained
somewhere?

csn

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
This topic is locked and can not be replied to.