Last active
May 5, 2023 14:22
-
-
Save btoews/e7832364bff787c9aa68424af19c6374 to your computer and use it in GitHub Desktop.
AR bug repro
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
require 'bundler/inline' | |
gemfile(true) do | |
source 'https://rubygems.org' | |
gem 'rails', '=6.1.5.1' | |
gem 'sqlite3' | |
end | |
require 'active_record' | |
require 'minitest/autorun' | |
require 'logger' | |
ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:') | |
ActiveRecord::Base.logger = Logger.new(STDOUT) | |
ActiveRecord::Schema.define { create_table(:foos, force: true) } | |
Foo = Class.new(ActiveRecord::Base) | |
class BugTest < Minitest::Test | |
def test_association_stuff | |
5.times { Foo.create } | |
assert_equal [3], Foo.where(id: [1,2,3]).merge(Foo.where(id: [3,4,5])).pluck(:id) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment