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.
@@ -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).size > 0
187
+ count(:conditions => ids) > 0
188
188
  else
189
189
  obj = find(ids) rescue false
190
190
  !obj.nil? and obj.is_a?(self)
@@ -2,7 +2,7 @@ module CompositePrimaryKeys
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 2
4
4
  MINOR = 2
5
- TINY = 1
5
+ TINY = 2
6
6
  STRING = [MAJOR, MINOR, TINY].join('.')
7
7
  end
8
8
  end
@@ -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
Binary file
@@ -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.1</a>
36
+ <a href="http://rubyforge.org/projects/compositekeys" class="numbers">2.2.2</a>
37
37
  </div>
38
38
  <h1>&#8594; Ruby on Rails</h1>
39
39
  <h1>&#8594; ActiveRecords</h1>
@@ -1,3 +1,3 @@
1
1
  // Announcement JS file
2
- var version = "2.2.1";
2
+ var version = "2.2.2";
3
3
  MagicAnnouncement.show('compositekeys', version);
@@ -1,4 +1,4 @@
1
1
  // Version JS file
2
- var version = "2.2.1";
2
+ var version = "2.2.2";
3
3
 
4
4
  document.write(" - " + version);
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.1
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-21 00:00:00 -06:00
12
+ date: 2009-01-24 00:00:00 -06:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency