Cant use with clauses in find_by_sql
- by PaulMurrayCbr
Activerecord seems to be peeking at my sql and getting it wrong. I am finding that this:
sql = "
select etn.*
from edittree_name etn where id = #{id}"
Name.find_by_sql(sql)
works, but this:
sql = "
with pp as ( select * from dual)
select etn.*
from edittree_name etn where id = #{id}"
Name.find_by_sql(sql)
Gives me a "undefined method `each' for 1:Fixnum".
Any clues? Is there a "find_by_raw_sql (and don't try to understand it yourself)" method?