From 256699519a2b56c332303c0d21cd8ff8f7ef47d7 Mon Sep 17 00:00:00 2001
From: Heinrich Lee Yu <heinrich@gitlab.com>
Date: Thu, 18 Apr 2019 17:48:17 +0800
Subject: [PATCH] Bump Rails version to 5.1.7

Removes unneeded patches
---
 Gemfile                                       |  2 +-
 Gemfile.lock                                  | 68 +++++++++----------
 .../active_record_attr_mutation_tracker.rb    | 16 -----
 config/initializers/active_record_becomes.rb  | 29 --------
 4 files changed, 35 insertions(+), 80 deletions(-)
 delete mode 100644 config/initializers/active_record_attr_mutation_tracker.rb
 delete mode 100644 config/initializers/active_record_becomes.rb

diff --git a/Gemfile b/Gemfile
index c12ab5cd15d58..deeacbf30cd8b 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,6 +1,6 @@
 source 'https://rubygems.org'
 
-gem 'rails', '5.1.6.1'
+gem 'rails', '5.1.7'
 
 # Improves copy-on-write performance for MRI
 gem 'nakayoshi_fork', '~> 0.0.4'
diff --git a/Gemfile.lock b/Gemfile.lock
index 31ffc0fd3084c..46c4b25b74eb7 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -4,41 +4,41 @@ GEM
     RedCloth (4.3.2)
     abstract_type (0.0.7)
     ace-rails-ap (4.1.2)
-    actioncable (5.1.6.1)
-      actionpack (= 5.1.6.1)
+    actioncable (5.1.7)
+      actionpack (= 5.1.7)
       nio4r (~> 2.0)
       websocket-driver (~> 0.6.1)
-    actionmailer (5.1.6.1)
-      actionpack (= 5.1.6.1)
-      actionview (= 5.1.6.1)
-      activejob (= 5.1.6.1)
+    actionmailer (5.1.7)
+      actionpack (= 5.1.7)
+      actionview (= 5.1.7)
+      activejob (= 5.1.7)
       mail (~> 2.5, >= 2.5.4)
       rails-dom-testing (~> 2.0)
-    actionpack (5.1.6.1)
-      actionview (= 5.1.6.1)
-      activesupport (= 5.1.6.1)
+    actionpack (5.1.7)
+      actionview (= 5.1.7)
+      activesupport (= 5.1.7)
       rack (~> 2.0)
       rack-test (>= 0.6.3)
       rails-dom-testing (~> 2.0)
       rails-html-sanitizer (~> 1.0, >= 1.0.2)
-    actionview (5.1.6.1)
-      activesupport (= 5.1.6.1)
+    actionview (5.1.7)
+      activesupport (= 5.1.7)
       builder (~> 3.1)
       erubi (~> 1.4)
       rails-dom-testing (~> 2.0)
       rails-html-sanitizer (~> 1.0, >= 1.0.3)
-    activejob (5.1.6.1)
-      activesupport (= 5.1.6.1)
+    activejob (5.1.7)
+      activesupport (= 5.1.7)
       globalid (>= 0.3.6)
-    activemodel (5.1.6.1)
-      activesupport (= 5.1.6.1)
-    activerecord (5.1.6.1)
-      activemodel (= 5.1.6.1)
-      activesupport (= 5.1.6.1)
+    activemodel (5.1.7)
+      activesupport (= 5.1.7)
+    activerecord (5.1.7)
+      activemodel (= 5.1.7)
+      activesupport (= 5.1.7)
       arel (~> 8.0)
     activerecord_sane_schema_dumper (1.0)
       rails (>= 5, < 6)
-    activesupport (5.1.6.1)
+    activesupport (5.1.7)
       concurrent-ruby (~> 1.0, >= 1.0.2)
       i18n (>= 0.7, < 2)
       minitest (~> 5.1)
@@ -185,7 +185,7 @@ GEM
       mail (~> 2.7)
     encryptor (3.0.0)
     equalizer (0.0.11)
-    erubi (1.7.1)
+    erubi (1.8.0)
     escape_utils (1.2.1)
     et-orbi (1.1.7)
       tzinfo
@@ -659,17 +659,17 @@ GEM
       rack
     rack-test (1.1.0)
       rack (>= 1.0, < 3)
-    rails (5.1.6.1)
-      actioncable (= 5.1.6.1)
-      actionmailer (= 5.1.6.1)
-      actionpack (= 5.1.6.1)
-      actionview (= 5.1.6.1)
-      activejob (= 5.1.6.1)
-      activemodel (= 5.1.6.1)
-      activerecord (= 5.1.6.1)
-      activesupport (= 5.1.6.1)
+    rails (5.1.7)
+      actioncable (= 5.1.7)
+      actionmailer (= 5.1.7)
+      actionpack (= 5.1.7)
+      actionview (= 5.1.7)
+      activejob (= 5.1.7)
+      activemodel (= 5.1.7)
+      activerecord (= 5.1.7)
+      activesupport (= 5.1.7)
       bundler (>= 1.3.0)
-      railties (= 5.1.6.1)
+      railties (= 5.1.7)
       sprockets-rails (>= 2.0.0)
     rails-controller-testing (1.0.2)
       actionpack (~> 5.x, >= 5.0.1)
@@ -683,9 +683,9 @@ GEM
     rails-i18n (5.1.1)
       i18n (>= 0.7, < 2)
       railties (>= 5.0, < 6)
-    railties (5.0.7.2)
-      actionpack (= 5.0.7.2)
-      activesupport (= 5.0.7.2)
+    railties (5.1.7)
+      actionpack (= 5.1.7)
+      activesupport (= 5.1.7)
       method_source
       rake (>= 0.8.7)
       thor (>= 0.18.1, < 2.0)
@@ -1141,7 +1141,7 @@ DEPENDENCIES
   rack-cors (~> 1.0.0)
   rack-oauth2 (~> 1.9.3)
   rack-proxy (~> 0.6.0)
-  rails (= 5.1.6.1)
+  rails (= 5.1.7)
   rails-controller-testing
   rails-i18n (~> 5.1)
   rainbow (~> 3.0)
diff --git a/config/initializers/active_record_attr_mutation_tracker.rb b/config/initializers/active_record_attr_mutation_tracker.rb
deleted file mode 100644
index 0fd2ce56f2cbf..0000000000000
--- a/config/initializers/active_record_attr_mutation_tracker.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# Remove once https://github.com/rails/rails/pull/32498
-# is released on a 5.1.x rails version.
-# Commit on 5-1-stable branch: https://github.com/rails/rails/commit/6ef736625eddf6700f2e67f7849c79c92381abee
-
-module ActiveRecord
-  class AttributeMutationTracker
-    def changes
-      attr_names.each_with_object({}.with_indifferent_access) do |attr_name, result|
-        change = change_to_attribute(attr_name)
-        if change
-          result.merge!(attr_name => change)
-        end
-      end
-    end
-  end
-end
diff --git a/config/initializers/active_record_becomes.rb b/config/initializers/active_record_becomes.rb
deleted file mode 100644
index ec4799deeef3e..0000000000000
--- a/config/initializers/active_record_becomes.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-# rubocop:disable Gitlab/ModuleWithInstanceVariables
-
-# Remove once https://github.com/rails/rails/issues/32867
-# is released on a 5.1.x rails version.
-# Commit on 5-1-stable branch: https://github.com/rails/rails/commit/44f0df3f3980ba3aeca956839e1948b246ff34fe
-
-module ActiveRecord
-  module AttributeMethods
-    module Dirty
-      def attributes_in_database
-        mutations_from_database.changed_values
-      end
-    end
-  end
-
-  module Persistence
-    def becomes(klass)
-      became = klass.new
-      became.instance_variable_set("@attributes", @attributes)
-      became.instance_variable_set("@mutation_tracker", @mutation_tracker ||= nil)
-      became.instance_variable_set("@mutations_from_database", @mutations_from_database ||= nil)
-      became.instance_variable_set("@changed_attributes", attributes_changed_by_setter)
-      became.instance_variable_set("@new_record", new_record?)
-      became.instance_variable_set("@destroyed", destroyed?)
-      became.errors.copy!(errors)
-      became
-    end
-  end
-end
-- 
GitLab