jeudi 23 avril 2015

Activerecord Force Index with includes

I am trying to construct an ActiveRecord statement that forces an index, whilst also using includes.

The statement looks something like:

Job.from("jobs FORCE INDEX(index1,index2)").includes(:workflow)

however it seems AR doesn't like this and throws:

NoMethodError (undefined method `map' for "jobs FORCE INDEX(index1,index2)":Arel::Nodes::SqlLiteral):

Has anyone got any idea? All works okay if the includes statement is taken off so I assume it is trying to build the LEFT OUTER JOIN and table aliasing query...

Thanks M

Aucun commentaire:

Enregistrer un commentaire