I have a very strange issue when trying to use find_by_sql with Rails
3.0.7. Rails doesn’t return anything (empty result, []) but if I copy &
paste that exact same query into mysql, it returns a result.
This is what I’m trying in Rails:
Document.find_by_sql([“select d.* from documents d, categorizations cg,
combinations co where d.id = cg.document_id and co.id =
cg.combination_id and co.assigned_parent_category_id=?”, 1)
returns: []
and this is what I do in mysql: (the exact same query from above)
select documents.* from documents, categorizations, combinations where
documents.id = categorizations.document_id and combinations.id =
categorizations.combination_id and
combinations.assigned_parent_category_id=1
returns: 1 result
Could this be a Rails bug or am I doing something wrong??
Thanks in advance!