From what i can gather the with_scope feature doesn’t allow you to
specify which columns get selected. It appears to default to “*”. So
if i specify something like:
Question.with_scope( :find => {
:from => “questions q, answers a”,
:conditions => “q.owner = a.owner AND a.owner=1”
}) do
…
end
I’ll generate SQL like:
SELECT * FROM questions q, answers a WHERE (q.owner=a.owner AND
a.owner=1)
which might be fine if the column names in both questions and answers
were unique.
Would adding to active_record/base.rb the facility to specify what gets
selected make sense?
for example the following passed to with_scope:
:find => {
:select => “DISTINCT q.*”,
:from => “questions q, answers a”,
:conditions => “q.owner = a.owner AND a.owner=1”
}
Could generate the following:
SELECT DISTINCT q.* FROM questions q, answers a WHERE (q.owner=a.owner
AND a.owner=1)
I’m probably missing something here about how AR goes about doing
which this would right royally brake. But if
I’m not, does it make sense?
-vince
–
keys: http://codex.net/gpg.asc
Democracy is a device that insures we shall be governed no better than
we deserve.
– George Bernard Shaw