Is there a fundamental reason that AR.joins() does not support
parameterized conditions? I fully expected this to work
Document.
joins("LEFT JOIN `votes` ON `votes`.`v_id` = `document`.`id` AND
`votes`.`giver_id` = ?", user_id).
where('document.creator_id = ?', user_id, .....).
select('votes.*', `document.param1')
Then I read the docs :) By forcing the join where clause to the outer
where, have to handle NULL:
Document.
joins("LEFT JOIN `votes` ON `votes`.`v_id` = `document`.`id`").
where('document.creator_id = ? AND (`votes`.`giver_id` = ? OR
`votes`.`giver_id` IS NULL)', user_id, user_id).
select('votes.*', `document.param1')
So, before I investigated a PR, wanted to see if this had been considered
and passed on for whatever reason.
Thank you for your feedback.
Mark
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.