composite_primary_keys 7.0.3 → 7.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.rdoc +6 -0
- data/lib/composite_primary_keys/persistence.rb +5 -0
- data/lib/composite_primary_keys/relation.rb +2 -2
- data/lib/composite_primary_keys/version.rb +1 -1
- data/test/connections/databases.ci.yml +15 -0
- data/test/fixtures/restaurants_suburb.rb +3 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a45d32305e2b207027f386128b7b77714e65486
|
4
|
+
data.tar.gz: 1e574a8bedaeaca37da16e406fc6e3d1246bcee3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 390a1b12a5d5f1c2cf8a5c40538445f98432508dd4d68223a9ce7aa431f79280b49de4ab3cd344b8bd2e43116e0eac7ed19d07bcec56186a635330e77f5b1db7
|
7
|
+
data.tar.gz: 27f2fa1cc51821ae47ac57cd8d504cb58d7b7528b7a5f0096c4134f6595194ef729e48297b8df887b635829e2c0c1f26113591aaa5d951c73b49c541754454d5
|
data/History.rdoc
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
== 7.0.4 (2014-07-?)
|
2
|
+
|
3
|
+
* Fix overriding of Relation#where_values_hash (Pavel)
|
4
|
+
* Add travis CI support (Pavel)
|
5
|
+
* Run AR's original relation_for_destroy when primary key is not composite (Pavel)
|
6
|
+
|
1
7
|
== 7.0.3 (2014-07-04)
|
2
8
|
|
3
9
|
* Fixes for Rails 4.1.2+ compatibility (Tom Hughes)
|
@@ -10,6 +10,11 @@ module CompositePrimaryKeys
|
|
10
10
|
# self.class.arel_table[pk].eq(substitute))
|
11
11
|
#relation.bind_values = [[column, id]]
|
12
12
|
|
13
|
+
# run AR's original relation_for_destroy when primary key is not composite
|
14
|
+
if Array(self.class.primary_key).size <= 1
|
15
|
+
return super
|
16
|
+
end
|
17
|
+
|
13
18
|
relation = self.class.unscoped
|
14
19
|
|
15
20
|
Array(self.class.primary_key).each_with_index do |key, index|
|
@@ -60,7 +60,7 @@ module ActiveRecord
|
|
60
60
|
|
61
61
|
def add_cpk_where_values_hash
|
62
62
|
class << self
|
63
|
-
def where_values_hash
|
63
|
+
def where_values_hash(relation_table_name = table_name)
|
64
64
|
# CPK adds this so that it finds the Equality nodes beneath the And node:
|
65
65
|
#equalities = where_values.grep(Arel::Nodes::Equality).find_all { |node|
|
66
66
|
# node.left.relation.name == table_name
|
@@ -68,7 +68,7 @@ module ActiveRecord
|
|
68
68
|
nodes_from_and = where_values.grep(Arel::Nodes::And).map {|and_node| and_node.children.grep(Arel::Nodes::Equality) }.flatten
|
69
69
|
|
70
70
|
equalities = (nodes_from_and + where_values.grep(Arel::Nodes::Equality)).find_all { |node|
|
71
|
-
node.left.relation.name ==
|
71
|
+
node.left.relation.name == relation_table_name
|
72
72
|
}
|
73
73
|
|
74
74
|
binds = Hash[bind_values.find_all(&:first).map { |column, v| [column.name, v] }]
|
@@ -0,0 +1,15 @@
|
|
1
|
+
mysql:
|
2
|
+
adapter: mysql2
|
3
|
+
username: travis
|
4
|
+
password: ""
|
5
|
+
database: composite_primary_keys_unittest
|
6
|
+
|
7
|
+
sqlite3:
|
8
|
+
adapter: sqlite3
|
9
|
+
database: db/composite_primary_keys_unittest.sqlite
|
10
|
+
|
11
|
+
postgresql:
|
12
|
+
adapter: postgresql
|
13
|
+
database: composite_primary_keys_unittest
|
14
|
+
username: postgres
|
15
|
+
host: localhost
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: composite_primary_keys
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.0.
|
4
|
+
version: 7.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Charlie Savage
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -86,6 +86,7 @@ files:
|
|
86
86
|
- test/README_tests.rdoc
|
87
87
|
- test/abstract_unit.rb
|
88
88
|
- test/connections/connection_spec.rb
|
89
|
+
- test/connections/databases.ci.yml
|
89
90
|
- test/connections/databases.example.yml
|
90
91
|
- test/connections/databases.yml
|
91
92
|
- test/connections/native_ibm_db/connection.rb
|
@@ -139,6 +140,7 @@ files:
|
|
139
140
|
- test/fixtures/reference_types.yml
|
140
141
|
- test/fixtures/restaurant.rb
|
141
142
|
- test/fixtures/restaurants.yml
|
143
|
+
- test/fixtures/restaurants_suburb.rb
|
142
144
|
- test/fixtures/restaurants_suburbs.yml
|
143
145
|
- test/fixtures/room.rb
|
144
146
|
- test/fixtures/room_assignment.rb
|