composite_primary_keys 0.6.3 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/lib/composite_primary_keys/base.rb +8 -5
- data/lib/composite_primary_keys/version.rb +2 -2
- metadata +2 -2
data/Rakefile
CHANGED
@@ -18,7 +18,7 @@ RUBY_FORGE_PROJECT = "compositekeys"
|
|
18
18
|
RUBY_FORGE_USER = "nicwilliams"
|
19
19
|
|
20
20
|
PKG_FILES = FileList[
|
21
|
-
"lib/**/*", "test/**/*", "examples/**/*", "doc/**/*", "[A-Z]*", "install.rb", "Rakefile"
|
21
|
+
"lib/**/*", "test/**/*", "examples/**/*", "doc/**/*", "scripts/**/*", "website/**/*", "[A-Z]*", "install.rb", "CHANGELOG", "README", "Rakefile"
|
22
22
|
].exclude(/\bCVS\b|~$/)
|
23
23
|
|
24
24
|
|
@@ -151,7 +151,7 @@ module CompositePrimaryKeys
|
|
151
151
|
connection.update(
|
152
152
|
"UPDATE #{self.class.table_name} " +
|
153
153
|
"SET #{quoted_comma_pair_list(connection, attributes_with_quotes(false))} " +
|
154
|
-
"WHERE (#{self.class.primary_key}) = (#{
|
154
|
+
"WHERE (#{self.class.primary_key}) = (#{quoted_id})",
|
155
155
|
"#{self.class.name} Update"
|
156
156
|
)
|
157
157
|
return true
|
@@ -276,10 +276,13 @@ module CompositePrimaryKeys
|
|
276
276
|
# If ids = [[10, 50], [11, 51]], then :conditions =>
|
277
277
|
# "(#{table_name}.a, #{table_name}.b) IN ((10, 50), (11, 51))"
|
278
278
|
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
279
|
+
conditions = ids.map do |id_set|
|
280
|
+
[primary_keys, id_set].transpose.map do |key, id|
|
281
|
+
"#{table_name}.#{key.to_s}=#{sanitize(id)}"
|
282
|
+
end.join(" AND ")
|
283
|
+
end.join(") OR (")
|
284
|
+
options.update :conditions => "(#{conditions})"
|
285
|
+
|
283
286
|
result = find_every(options)
|
284
287
|
|
285
288
|
if result.size == ids.size
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
|
|
3
3
|
specification_version: 1
|
4
4
|
name: composite_primary_keys
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.
|
7
|
-
date: 2006-08-
|
6
|
+
version: 0.7.0
|
7
|
+
date: 2006-08-31 00:00:00 +02:00
|
8
8
|
summary: Support for composite primary keys in ActiveRecords
|
9
9
|
require_paths:
|
10
10
|
- lib
|