rom-rb / rom-sql

SQL support for rom-rb
https://rom-rb.org
MIT License
217 stars 93 forks source link

Translate symbols in a hash applied to `Relation#where` to attributes #396

Open flash-gordon opened 3 years ago

flash-gordon commented 3 years ago

We store qualified attributes in schemas, that's good. But when you call .where(name: 'abc') then symbols from the hash don't get converted to attributes from the schema and thus get translated to unqualified SQL identifiers. At the same time, using the block syntax will produce qualified attributes: where { name.is('abc') }. This discrepancy confuses people, we should transform symbol keys into qualified attributes. This will be a breaking change.

solnic commented 3 years ago

Ah yes, we wanted to do it long time ago :) I'm glad you reported an issue about it <3