do |t| t.string :state end end class Business < ActiveRecord::Base scope :open, -> { where(state: "open") } scope :available, -> { open } end 23 — WebDev Meetup Chur - 18.10.2018 - Joel Ambass
do |t| t.string :state end end class Business < ActiveRecord::Base scope :open, -> { where(state: "open") } scope :available, -> { open } end 23 — WebDev Meetup Chur - 18.10.2018 - Joel Ambass
Business.create!(state: nil) Business.create!(state: :open) assert_equal Business.available, Business.open end end 24 — WebDev Meetup Chur - 18.10.2018 - Joel Ambass
"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" # Activate the gem you are reporting the issue against. gem "activerecord", '5.2.0' 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::Base.logger = Logger.new(STDOUT) ActiveRecord::Schema.define do create_table :businesses, force: true do |t| t.string :state end end class Business < ActiveRecord::Base scope :open, -> { where(state: "open") } scope :available, -> { open } end class BugTest < Minitest::Test def test_overwritten_open Business.create!(state: nil) Business.create!(state: :open) assert_equal Business.available, Business.open end end 25 — WebDev Meetup Chur - 18.10.2018 - Joel Ambass
# Activate the gem you are reporting the issue against. gem "activerecord", '5.1.0' gem "sqlite3" end 27 — WebDev Meetup Chur - 18.10.2018 - Joel Ambass
on all commits between two given. ▸ checks out each of those commits. ▸ tells us which commit introduced the bug. 38 — WebDev Meetup Chur - 18.10.2018 - Joel Ambass
bisect bad # Current version is bad $ git bisect good 5-1-stable # 5-1-stable is known to be good # run script $ ruby test.rb # mark as bad $ git bisect bad # or mark as good $ git bisect good # repeat from run script... 41 — WebDev Meetup Chur - 18.10.2018 - Joel Ambass
bisect bad # Current version is bad $ git bisect good 5-1-stable # 5-1-stable is known to be good $ git bisect run ruby test.rb # run script 44 — WebDev Meetup Chur - 18.10.2018 - Joel Ambass
4bdd86fb1e608d0031ee5e03af4ae0b13b41fea3 Author: Ryuta Kamizono <[email protected]> Date: Thu Jun 1 04:40:55 2017 +0900 The receiver in a scope should be a `relation` Currently the receiver in a scope is `klass`, not `relation`. I think it is a strange because the receiver in `default_scope` and a scope on association is `relation`. I fixed to the receiver is to be a `relation` properly for consistency. :040000 040000 72808c470ac5f21220d7706092fec572eed33bfe e172211262e36eefaa17c0c356b3889ad1d5f38a M activerecord bisect run success 45 — WebDev Meetup Chur - 18.10.2018 - Joel Ambass
▸ See which commit improved performance in benchmarks. ▸ See which commit changed any kind of behaviour. 49 — WebDev Meetup Chur - 18.10.2018 - Joel Ambass