composite_primary_keys 2.2.1 → 2.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/composite_primary_keys/base.rb +1 -1
- data/lib/composite_primary_keys/version.rb +1 -1
- data/test/test_exists.rb +2 -0
- data/tmp/test.db +0 -0
- data/website/index.html +1 -1
- data/website/version-raw.js +1 -1
- data/website/version.js +1 -1
- metadata +2 -2
@@ -184,7 +184,7 @@ module CompositePrimaryKeys
|
|
184
184
|
# Person.exists?(5,7)
|
185
185
|
def exists?(ids)
|
186
186
|
if ids.is_a?(Array) && ids.first.is_a?(String)
|
187
|
-
count(:conditions => ids)
|
187
|
+
count(:conditions => ids) > 0
|
188
188
|
else
|
189
189
|
obj = find(ids) rescue false
|
190
190
|
!obj.nil? and obj.is_a?(self)
|
data/test/test_exists.rb
CHANGED
@@ -19,9 +19,11 @@ class TestExists < Test::Unit::TestCase
|
|
19
19
|
|
20
20
|
def test_composite_key_exists_giving_ids_as_array
|
21
21
|
assert Department.exists?([1,1])
|
22
|
+
assert_equal(false, Department.exists?([1111,1111]))
|
22
23
|
end
|
23
24
|
|
24
25
|
def test_composite_key_exists_giving_ids_as_condition
|
25
26
|
assert Department.exists?(['department_id = ? and location_id = ?', 1, 1])
|
27
|
+
assert_equal(false, Department.exists?(['department_id = ? and location_id = ?', 11111, 11111]))
|
26
28
|
end
|
27
29
|
end
|
data/tmp/test.db
CHANGED
Binary file
|
data/website/index.html
CHANGED
@@ -33,7 +33,7 @@
|
|
33
33
|
<h1>Composite Primary Keys</h1>
|
34
34
|
<div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/compositekeys"; return false'>
|
35
35
|
Get Version
|
36
|
-
<a href="http://rubyforge.org/projects/compositekeys" class="numbers">2.2.
|
36
|
+
<a href="http://rubyforge.org/projects/compositekeys" class="numbers">2.2.2</a>
|
37
37
|
</div>
|
38
38
|
<h1>→ Ruby on Rails</h1>
|
39
39
|
<h1>→ ActiveRecords</h1>
|
data/website/version-raw.js
CHANGED
data/website/version.js
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: composite_primary_keys
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dr Nic Williams
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-01-
|
12
|
+
date: 2009-01-24 00:00:00 -06:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|