All,
I''m having some difficulties with the #{} replacements in ActiveRecord
that I haven''t seen mentioned on the list.
I have a number of has_many relationships that use finder_sql queries
dependent on dynamic data. I''ve seen that you need to single-quote the
queries to make your terms work, and that''s been good for simple cases.
What I''ve found is that things like #{self.id} work fine, but more
complex references, such as #{self.related.name} (where related is a
belongs_to relationship in the model) won''t work.
The stack trace infers that the problem is with interpolate_sql in
active_record/base.rb (line 1314).
I guess I''m trying to do too much here, and I''m not sure what
to try
instead. Any suggestions?
BTW, the actual query I''m running is rather large, and needs a number
of
joins, so I''m not sure that using find() would do it.
Thanks,
Paul