I wonder if there is a simple way to do a INNER JOIN with rails instead
of having to resort to find_by_sql and having to write the sql query
I have tasks linked to folders via habtm and tasks are also linked to
documents via habtm. I now want to see the documents linked to a given
folder (via its associated tasks)
So in folder.rb I have a function:
if !tids.blank? then
return Document.find_by_sql(“SELECT distinct documents.* from
documents inner join task_events on documents.id=task_events.general_int
where task_events.event_type=‘ATTACH’ and task_events.task_id
This works, but there must be a easier way to do this using ORM?
Comments and suggestions most welcome!