Created
June 18, 2019 21:06
-
-
Save Edouard-chin/3125980e00edaf5ada161ef084cb6a67 to your computer and use it in GitHub Desktop.
Reorder SQL difference
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" | |
git_source(:github) { |repo| "https://github.com/#{repo}.git" } | |
# Activate the gem you are reporting the issue against. | |
gem "activerecord", github: 'rails/rails', ref: '1340498d2102423665cc5cfe7be7cdba32c72928' | |
gem "sqlite3" | |
end | |
require "active_record" | |
require "minitest/autorun" | |
require "logger" | |
# This connection will do for database-independent bug reports. | |
ActiveRecord::Base.establish_connection(adapter: "sqlite3", database: ":memory:") | |
ActiveRecord::Base.logger = Logger.new(STDOUT) | |
ActiveRecord::Schema.define do | |
create_table :posts, force: true do |t| | |
t.string :name | |
end | |
end | |
class Post < ActiveRecord::Base | |
end | |
class BugTest < Minitest::Test | |
def test_association_stuff | |
Post.create!(name: 'Roger') | |
Post.create!(name: 'Josie') | |
Post.create!(name: 'Hector') | |
Post.reorder(nil).first | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment