ActiveRecord appends ‘AND (1=0)’ to end of queries
Rails will generate SQL like AND (1=0) when you query for a column whose value is in an empty array: Child.where(id: []) Intuitively, you’d expect that to generate SQL like SELECT * FROM children WHERE id IN (), but () isn’t actually valid SQL. Since no rows will match that query, though, Rails works around … Read more