Displaying 2 results from an estimated 2 matches for "post_subscript".
2006 Jul 24
1
has_many + finder_sql
from the api I got:
<pre>
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''
</pre>
I would like to pass in the the id of the object that calls
subscribers.
for instance @email.subscribers could have the association:
h...
2006 Feb 13
0
has_many finder_sql #{id} single/double quotes voodoo
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...