ActiveRecord.find - Association Not Found Error When Using Custom Joins


When calling the find method on one of my models, I am joining to
several other table using the :joins parameter. Currently, the :joins
parameter is being populated with an array of several associations.
However, I need to add a custom join, but when I add a string with my
custom join to the joins array, I get the following error:

Association named ' INNER JOIN ... ' was not found; perhaps you
misspelled it?

According to the documentation found here:,
the :joins parameter can contains "an array containing a mixture of
both strings and named associations." That is exactly what I'm doing,
so I'm not sure why I'm getting this error when trying to combing

Any ideas why this error would occur?


A cursory look at the code suggests that nothing is being done to
handle the case of a mixture of strings & named associations.


Well, example code, yours to be exact, would help in diagnosing the

Otherwise, it's simply 'you must have implemented something incorrectly'

It looks like you are right Fred, the code doesn't actually handle a
mixture of strings and associations. I found the following patch to
fix the problem: