You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On the other hand, ActiveRecord generates "users"."a" = 1 AND "users"."a" = 2, and it returns empty set.
require"bundler/inline"gemfiledosource"https://rubygems.org"gem"activerecord","6.1.0"gem"sqlite3"endrequire"active_record"# This connection will do for database-independent bug reports.ActiveRecord::Base.establish_connection(adapter: "sqlite3",database: ":memory:")ActiveRecord::Base.logger=Logger.new("/dev/null")ActiveRecord::Schema.definedocreate_table:users,force: truedo |t|
t.integer:aendendclassUser < ActiveRecord::BaseendputsUser.where(a: 1).where(a: 2).to_sql#=> SELECT "users".* FROM "users" WHERE "users"."a" = 1 AND "users"."a" = 2
These behaviors are opposite and can confuse us when building queries with split scoped or methods. So I request to add an option or something like that to make Plucky's behavior compatible with ActiveRecords' one.
The text was updated successfully, but these errors were encountered:
Currently, Plucky and ActiveRecord generate different queries when calling
where
clause method twice with the same key, i.g.where(a: 1).where(a: 2)
.Plucky generates
{ :a => { :$in => [1, 2] } }
, and it behaves like{ :$or => [{ :a => 1 }, { :a => 2 }] }
.On the other hand, ActiveRecord generates
"users"."a" = 1 AND "users"."a" = 2
, and it returns empty set.These behaviors are opposite and can confuse us when building queries with split scoped or methods. So I request to add an option or something like that to make Plucky's behavior compatible with ActiveRecords' one.
The text was updated successfully, but these errors were encountered: