]> git.openstreetmap.org Git - rails.git/commitdiff
Update CPK to 4.1.2 and drop monkey patch
authorTom Hughes <tom@compton.nu>
Sat, 21 Jan 2012 00:44:34 +0000 (00:44 +0000)
committerTom Hughes <tom@compton.nu>
Sat, 21 Jan 2012 00:44:34 +0000 (00:44 +0000)
Gemfile
Gemfile.lock
config/initializers/composite_primary_keys.rb [deleted file]

diff --git a/Gemfile b/Gemfile
index 08dafa0cc6e08029d2c358bccf77ed3ec7325384..3050d9fa3a91fe54af1cb8089ee5cc7784b963dc 100644 (file)
--- a/Gemfile
+++ b/Gemfile
@@ -17,7 +17,7 @@ gem 'rinku', '>= 1.2.2', :require => 'rails_rinku'
 gem 'oauth-plugin', '>= 0.4.0.pre7'
 gem 'open_id_authentication', '>= 1.1.0'
 gem 'validates_email_format_of', '>= 1.5.1'
-gem 'composite_primary_keys', '>= 4.1.1'
+gem 'composite_primary_keys', '>= 4.1.2'
 
 # Load libxml support for XML parsing and generation
 gem 'libxml-ruby', '>= 2.0.5', :require => 'libxml'
index 241e79e92c55e690484c9e7d966a3cb6336f8351..35082453254a9d990182d0c2816876d95c8d5590 100644 (file)
@@ -39,24 +39,24 @@ GEM
     coffee-script (2.2.0)
       coffee-script-source
       execjs
-    coffee-script-source (1.1.3)
-    composite_primary_keys (4.1.1)
+    coffee-script-source (1.2.0)
+    composite_primary_keys (4.1.2)
       activerecord (~> 3.1)
     dynamic_form (1.1.4)
     erubis (2.7.0)
-    execjs (1.2.9)
+    execjs (1.3.0)
       multi_json (~> 1.0)
     faraday (0.7.5)
       addressable (~> 2.2.6)
       multipart-post (~> 1.1.3)
       rack (>= 1.1.0, < 2)
     hike (1.2.1)
-    httpclient (2.2.3)
+    httpclient (2.2.4)
     i18n (0.6.0)
-    jquery-rails (1.0.18)
+    jquery-rails (1.0.19)
       railties (~> 3.0)
       thor (~> 0.14)
-    json (1.6.1)
+    json (1.6.5)
     libv8 (3.3.10.4)
     libxml-ruby (2.2.2)
     mail (2.3.0)
@@ -64,10 +64,10 @@ GEM
       mime-types (~> 1.16)
       treetop (~> 1.4.8)
     memcache-client (1.8.5)
-    memcached (1.3.5)
+    memcached (1.3.6)
     mime-types (1.17.2)
-    multi_json (1.0.3)
-    multipart-post (1.1.3)
+    multi_json (1.0.4)
+    multipart-post (1.1.4)
     nokogiri (1.5.0)
     oauth (0.4.5)
     oauth-plugin (0.4.0.rc2)
@@ -75,14 +75,14 @@ GEM
       oauth (~> 0.4.4)
       oauth2
       rack
-    oauth2 (0.5.1)
-      faraday (~> 0.7.4)
-      multi_json (~> 1.0.3)
+    oauth2 (0.5.2)
+      faraday (~> 0.7)
+      multi_json (~> 1.0)
     open_id_authentication (1.1.0)
       rack-openid (~> 1.3)
-    pg (0.11.0)
+    pg (0.12.2)
     polyglot (0.3.3)
-    rack (1.3.5)
+    rack (1.3.6)
     rack-cache (1.1)
       rack (>= 0.4)
     rack-mount (0.8.3)
@@ -114,14 +114,14 @@ GEM
       rdoc (~> 3.4)
       thor (~> 0.14.6)
     rake (0.9.2.2)
-    rdoc (3.11)
+    rdoc (3.12)
       json (~> 1.4)
-    rinku (1.4.1)
+    rinku (1.5.0)
     rmagick (2.13.1)
     ruby-openid (2.1.8)
     sanitize (2.0.3)
       nokogiri (>= 1.4.4, < 1.6)
-    sass (3.1.10)
+    sass (3.1.12)
     sass-rails (3.1.5)
       actionpack (~> 3.1.0)
       railties (~> 3.1.0)
@@ -140,7 +140,7 @@ GEM
       polyglot
       polyglot (>= 0.3.1)
     tzinfo (0.3.31)
-    uglifier (1.1.0)
+    uglifier (1.2.2)
       execjs (>= 0.3.0)
       multi_json (>= 1.0.2)
     validates_email_format_of (1.5.3)
@@ -151,7 +151,7 @@ PLATFORMS
 DEPENDENCIES
   SystemTimer (>= 1.1.3)
   coffee-rails (~> 3.1.0)
-  composite_primary_keys (>= 4.1.1)
+  composite_primary_keys (>= 4.1.2)
   dynamic_form
   httpclient
   jquery-rails
diff --git a/config/initializers/composite_primary_keys.rb b/config/initializers/composite_primary_keys.rb
deleted file mode 100644 (file)
index e928df3..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-module ActiveRecord
-  module Associations
-    class AssociationScope
-      def add_constraints(scope)
-        tables = construct_tables
-
-        chain.each_with_index do |reflection, i|
-          table, foreign_table = tables.shift, tables.first
-
-          if reflection.source_macro == :has_and_belongs_to_many
-            join_table = tables.shift
-
-            # CPK
-            # scope = scope.joins(join(
-            #  join_table,
-            #  table[reflection.active_record_primary_key].
-            #    eq(join_table[reflection.association_foreign_key])
-            #))
-            predicate = cpk_join_predicate(table, reflection.association_primary_key,
-                                           join_table, reflection.association_foreign_key)
-            scope = scope.joins(join(join_table, predicate))
-
-            table, foreign_table = join_table, tables.first
-          end
-
-          if reflection.source_macro == :belongs_to
-            if reflection.options[:polymorphic]
-              key = reflection.association_primary_key(klass)
-            else
-              key = reflection.association_primary_key
-            end
-
-            foreign_key = reflection.foreign_key
-          else
-            key         = reflection.foreign_key
-            foreign_key = reflection.active_record_primary_key
-          end
-
-          conditions = self.conditions[i]
-
-          if reflection == chain.last
-            # CPK
-            # scope = scope.where(table[key].eq(owner[foreign_key]))
-            predicate = cpk_join_predicate(table, key, owner, foreign_key)
-            scope = scope.where(predicate)
-
-            if reflection.type
-              scope = scope.where(table[reflection.type].eq(owner.class.base_class.name))
-            end
-
-            conditions.each do |condition|
-              if options[:through] && condition.is_a?(Hash)
-                condition = { table.name => condition }
-              end
-
-              scope = scope.where(interpolate(condition))
-            end
-          else
-            # CPK
-            # constraint = table[key].eq(foreign_table[foreign_key])
-            constraint = cpk_join_predicate(table, key, foreign_table, foreign_key)
-
-            if reflection.type
-              type = chain[i + 1].klass.base_class.name
-              constraint = constraint.and(table[reflection.type].eq(type))
-            end
-
-            scope = scope.joins(join(foreign_table, constraint))
-
-            unless conditions.empty?
-              scope = scope.where(sanitize(conditions, table))
-            end
-          end
-        end
-
-        scope
-      end
-    end
-  end
-end