4 ms·
Yeah we just changed the meaning of 'or', no biggie. That said I would normally read 'User.where({id: id}).or({condition1},{condition2})' as 'User where id=id
by contravariant 5y ago
Yeah we just changed the meaning of 'or', no biggie.
That said I would normally read 'User.where({id: id}).or({condition1},{condition2})' as 'User where id=id or condition1 or condition2' and not 'User where id=id and (condition1 or condition2)'. Though I could probably get used to either, after all you've also got languages like Lisp where 'or' isn't an infix operator either.
And doing something with any one of the results when you only expect one result to exist is just bad practice.
- Sebb767 5y ago> That said I would normally read '[...]' as '[...]' The problem is, once you deploy to production you have (hopefully) tested this case and rely on the actual implementation.
- jve 5y agoComing from .NET/LINQ/SQL, I would have assumed the latter. But then again, if I'd ever write ruby, I should have consulted the docs. But this kind of behavior change at best should have introduced different API. Crazy to think that someone remotely can alter your query ANDs to ORs. That may very well destroy your database data and a whole lot of pain to rollback.