cowtech-rails 1.7.0.3 → 1.7.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -21,7 +21,7 @@ module Cowtech
21
21
  end
22
22
 
23
23
  def self.[](what, only_id = false)
24
- self.__finalize(self.__index_find(what), only_id)
24
+ self.__finalize(self.__safe_index_find(what), only_id)
25
25
  end
26
26
 
27
27
  def safe_id
@@ -57,7 +57,7 @@ module Cowtech
57
57
  end
58
58
 
59
59
  def is?(other)
60
- other ? (self.id == self.class.__index_find(other).id) : false
60
+ other ? (self.id == self.class.__safe_index_find(other).id) : false
61
61
  end
62
62
 
63
63
  private
@@ -72,6 +72,18 @@ module Cowtech
72
72
  nil
73
73
  end
74
74
  end
75
+
76
+ def self.__safe_index_find(what)
77
+ record = nil
78
+
79
+ begin
80
+ record = self.__index_find(what)
81
+ rescue ActiveRecord::RecordNotFound
82
+ record = nil
83
+ end
84
+
85
+ record
86
+ end
75
87
  end
76
88
  end
77
89
  end
@@ -9,8 +9,8 @@ module Cowtech
9
9
  module Version
10
10
  MAJOR = 1
11
11
  MINOR = 7
12
- PATCH = 0
13
- BUILD = 3
12
+ PATCH = 1
13
+ BUILD = 0
14
14
 
15
15
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
16
16
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cowtech-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0.3
4
+ version: 1.7.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-05-22 00:00:00.000000000Z
12
+ date: 2011-05-24 00:00:00.000000000Z
13
13
  dependencies: []
14
14
  description: A general purpose Rails utility plugin.
15
15
  email: shogun_panda@me.com