Skip to content
Advertisement

Relation passed to #or must be structurally compatible. Incompatible values: [:references]

I have two queries, I need an or between them, i.e. I want results that are returned by either the first or the second query.

First query is a simple where() which gets all available items.

Second includes a join() and gives the current user’s items.

I tried to combine these with Rails’ or() method in various forms, including:

But I keep running into this error and I’m not sure how to fix it.

Advertisement

Answer

There is a known issue about it on Github.

According to this comment you might want to override the structurally_incompatible_values_for_or to overcome the issue:

Also there is always an option to use SQL:

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement