Hello, I have a difficult question.
In my situtation I have to deal with EAV.
So, I we can imagine next models: Product, Option, Value
Product has many options through values.
And in this case how is better to search by this dynamic attributes from values?
I have to make joins to same table - values, and each join should have own conditions. So, I have to deal with aliases for this table.
But I can't access to aliases when I join tables by existing relations: .join(:values), or can I?
So, now I see just the one way - join without relations, but it produces doubled code.
And more - if I have a field "enabled" in options wich can be true or false, I should add this condition twice.
Is there more convenient way?