Last active
May 31, 2018 20:58
-
-
Save yosiat/2394bb7d660a99a69c777154b4246f59 to your computer and use it in GitHub Desktop.
This file contains 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
begin | |
require "bundler/inline" | |
rescue LoadError => e | |
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler" | |
raise e | |
end | |
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", "5.0.6" | |
gem "sqlite3" | |
end | |
require "active_record" | |
require "minitest/autorun" | |
require "logger" | |
# Ensure backward compatibility with Minitest 4 | |
Minitest::Test = MiniTest::Unit::TestCase unless defined?(Minitest::Test) | |
# This connection will do for database-independent bug reports. | |
ActiveRecord::Base.establish_connection(adapter: "sqlite3", database: ":memory:") | |
ActiveRecord::Schema.define do | |
create_table :users, force: true do |t| | |
t.boolean :admin | |
t.text :external_id | |
end | |
end | |
class User < ActiveRecord::Base | |
after_create do | |
update(external_id: "new string") unless external_id? | |
end | |
after_create do | |
if respond_to?(:saved_changes) | |
puts "Saved Changes: #{saved_changes}" | |
end | |
if respond_to?(:previous_changes) | |
puts "Preiovus Changes: #{previous_changes}" | |
end | |
end | |
end | |
ActiveRecord::Base.logger = Logger.new(STDOUT) | |
class BugTest < Minitest::Test | |
def test_association_stuff | |
user = User.create!(admin: true) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ActiveRecord 5.0.6
id, admin and external_id are in the changes
ActiveRecord 5.1.6
Saved Changes which is new approach has only external_id without id & admin