]> git.openstreetmap.org Git - rails.git/commitdiff
Update to CPK 6.0.1 and drop monkey patch
authorTom Hughes <tom@compton.nu>
Sat, 30 Nov 2013 10:20:22 +0000 (10:20 +0000)
committerTom Hughes <tom@compton.nu>
Sat, 30 Nov 2013 10:28:41 +0000 (10:28 +0000)
Gemfile
Gemfile.lock
config/initializers/composite_primary_keys.rb [deleted file]

diff --git a/Gemfile b/Gemfile
index 11008d9431190bf1cfd15f8ee2fb5dc170aa1017..94eb39681f56e81ed1087a039d258567fb5e9e69 100644 (file)
--- a/Gemfile
+++ b/Gemfile
@@ -41,7 +41,7 @@ gem 'rinku', '>= 1.2.2', :require => 'rails_rinku'
 gem 'oauth-plugin', '>= 0.5.1'
 gem 'open_id_authentication', '>= 1.1.0'
 gem 'validates_email_format_of', '>= 1.5.1'
 gem 'oauth-plugin', '>= 0.5.1'
 gem 'open_id_authentication', '>= 1.1.0'
 gem 'validates_email_format_of', '>= 1.5.1'
-gem 'composite_primary_keys', '>= 6.0.0'
+gem 'composite_primary_keys', '>= 6.0.1'
 gem 'http_accept_language', '~> 2.0.0'
 gem 'paperclip', '~> 3.0'
 gem 'deadlock_retry', '>= 1.2.0'
 gem 'http_accept_language', '~> 2.0.0'
 gem 'paperclip', '~> 3.0'
 gem 'deadlock_retry', '>= 1.2.0'
index d8dae468a3cd877cd81e14beaecf8dfa5b6dc8e0..2065dabdd725016a5384669e9cab72e71a6ebfa0 100644 (file)
@@ -11,7 +11,7 @@ GEM
       erubis (~> 2.7.0)
       rack (~> 1.5.2)
       rack-test (~> 0.6.2)
       erubis (~> 2.7.0)
       rack (~> 1.5.2)
       rack-test (~> 0.6.2)
-    actionpack-page_caching (1.0.1)
+    actionpack-page_caching (1.0.2)
       actionpack (>= 4.0.0, < 5)
     activemodel (4.0.1)
       activesupport (= 4.0.1)
       actionpack (>= 4.0.0, < 5)
     activemodel (4.0.1)
       activesupport (= 4.0.1)
@@ -43,7 +43,7 @@ GEM
       coffee-script-source
       execjs
     coffee-script-source (1.6.3)
       coffee-script-source
       execjs
     coffee-script-source (1.6.3)
-    composite_primary_keys (6.0.0)
+    composite_primary_keys (6.0.1)
       activerecord (>= 4.0.0)
     dalli (2.6.4)
     deadlock_retry (1.2.0)
       activerecord (>= 4.0.0)
     dalli (2.6.4)
     deadlock_retry (1.2.0)
@@ -75,7 +75,7 @@ GEM
     mail (2.5.4)
       mime-types (~> 1.16)
       treetop (~> 1.4.8)
     mail (2.5.4)
       mime-types (~> 1.16)
       treetop (~> 1.4.8)
-    mime-types (1.25)
+    mime-types (1.25.1)
     mini_portile (0.5.2)
     minitest (4.7.5)
     multi_json (1.8.2)
     mini_portile (0.5.2)
     minitest (4.7.5)
     multi_json (1.8.2)
@@ -107,12 +107,11 @@ GEM
       mime-types
     pg (0.17.0)
     polyglot (0.3.3)
       mime-types
     pg (0.17.0)
     polyglot (0.3.3)
-    psych (2.0.1)
+    psych (2.0.2)
     r2 (0.2.2)
     rack (1.5.2)
     r2 (0.2.2)
     rack (1.5.2)
-    rack-cors (0.2.8)
-      rack
-    rack-openid (1.4.0)
+    rack-cors (0.2.9)
+    rack-openid (1.4.1)
       rack (>= 1.1.0)
       ruby-openid (>= 2.1.8)
     rack-test (0.6.2)
       rack (>= 1.1.0)
       ruby-openid (>= 2.1.8)
     rack-test (0.6.2)
@@ -144,7 +143,7 @@ GEM
       railties (>= 4.0.0, < 5.0)
       sass (>= 3.1.10)
       sprockets-rails (~> 2.0.0)
       railties (>= 4.0.0, < 5.0)
       sass (>= 3.1.10)
       sprockets-rails (~> 2.0.0)
-    sprockets (2.10.0)
+    sprockets (2.10.1)
       hike (~> 1.2)
       multi_json (~> 1.0)
       rack (~> 1.0)
       hike (~> 1.2)
       multi_json (~> 1.0)
       rack (~> 1.0)
@@ -157,12 +156,12 @@ GEM
     thread_safe (0.1.3)
       atomic
     tilt (1.4.1)
     thread_safe (0.1.3)
       atomic
     tilt (1.4.1)
-    timecop (0.6.3)
+    timecop (0.7.0)
     treetop (1.4.15)
       polyglot
       polyglot (>= 0.3.1)
     tzinfo (0.3.38)
     treetop (1.4.15)
       polyglot
       polyglot (>= 0.3.1)
     tzinfo (0.3.38)
-    uglifier (2.3.0)
+    uglifier (2.3.1)
       execjs (>= 0.3.0)
       json (>= 1.8.0)
     validates_email_format_of (1.5.3)
       execjs (>= 0.3.0)
       json (>= 1.8.0)
     validates_email_format_of (1.5.3)
@@ -176,7 +175,7 @@ DEPENDENCIES
   actionpack-page_caching
   bigdecimal (~> 1.1.0)
   coffee-rails (~> 4.0.0)
   actionpack-page_caching
   bigdecimal (~> 1.1.0)
   coffee-rails (~> 4.0.0)
-  composite_primary_keys (>= 6.0.0)
+  composite_primary_keys (>= 6.0.1)
   dalli
   deadlock_retry (>= 1.2.0)
   dynamic_form
   dalli
   deadlock_retry (>= 1.2.0)
   dynamic_form
diff --git a/config/initializers/composite_primary_keys.rb b/config/initializers/composite_primary_keys.rb
deleted file mode 100644 (file)
index ed4d5f2..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-# Monkey patch composite_primary_keys pending the resolution of:
-# https://github.com/composite-primary-keys/composite_primary_keys/pull/170
-module ActiveRecord
-  module Associations
-    class HasManyAssociation
-      def delete_records(records, method)
-        if method == :destroy
-          records.each { |r| r.destroy }
-          update_counter(-records.length) unless inverse_updates_counter_cache?
-        else
-          if records == :all
-            scope = self.scope
-          else
-            # CPK
-            # keys  = records.map { |r| r[reflection.association_primary_key] }
-            # scope = scope.where(reflection.association_primary_key => keys)
-            table = Arel::Table.new(reflection.table_name)
-            and_conditions = records.map do |record|
-              eq_conditions = Array(reflection.association_primary_key).map do |name|
-                table[name].eq(record[name])
-              end
-              Arel::Nodes::And.new(eq_conditions)
-            end
-
-            condition = and_conditions.shift
-            and_conditions.each do |and_condition|
-              condition = condition.or(and_condition)
-            end
-
-            scope = self.scope.where(condition)
-          end
-
-          if method == :delete_all
-            update_counter(-scope.delete_all)
-          else
-            # CPK
-            # update_counter(-scope.update_all(reflection.foreign_key => nil))
-            updates = Array(reflection.foreign_key).inject(Hash.new) do |hash, name|
-              hash[name] = nil
-              hash
-            end
-            update_counter(-scope.update_all(updates))
-          end
-        end
-      end
-    end
-  end
-end