CachedSupermodel 0.1.2.4 → 0.1.2.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/Rakefile +1 -1
  2. data/lib/cs_active_record.rb +15 -1
  3. metadata +3 -3
data/Rakefile CHANGED
@@ -4,7 +4,7 @@ require 'rubygems'
4
4
  require 'hoe'
5
5
  require './lib/cached_supermodel.rb'
6
6
 
7
- Hoe.new('CachedSupermodel', '0.1.2.4') do |p|
7
+ Hoe.new('CachedSupermodel', '0.1.2.5') do |p|
8
8
  p.summary = 'A library that automatically caches all ActiveRecord::Base instances in memcache using the AdoccaMemcache gem.'
9
9
  p.description = p.paragraphs_of('README.txt', 2..5).join("\n\n")
10
10
  p.author = 'adocca Entertainment AB'
@@ -81,6 +81,16 @@ def self.#{finder}_get_ids(*args)
81
81
  end
82
82
  end
83
83
  def self.#{finder}(*args)
84
+ begin
85
+ self.#{finder}_orig(*args)
86
+ rescue ActiveRecord::RecordNotFound
87
+ nil
88
+ end
89
+ end
90
+ def self.#{finder}!(*args)
91
+ self.#{finder}_orig(*args)
92
+ end
93
+ def self.#{finder}_orig(*args)
84
94
  match = '#{finder}'.match(/^find_(all_)?by_(.*)$/)
85
95
  attributes = match[2].to_s.split(/_and_/)
86
96
  normal_arguments = args[0...attributes.size]
@@ -100,7 +110,11 @@ def self.#{finder}(*args)
100
110
  self.find(oid) rescue nil
101
111
  end.compact
102
112
  else
103
- rval.nil? ? nil : (self.find(rval) rescue nil)
113
+ if rval.nil?
114
+ raise ActiveRecord::RecordNotFound
115
+ else
116
+ self.find(rval)
117
+ end
104
118
  end
105
119
  end
106
120
  end
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.2
2
+ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: CachedSupermodel
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.1.2.4
7
- date: 2007-03-14 00:00:00 +01:00
6
+ version: 0.1.2.5
7
+ date: 2007-07-30 00:00:00 +02:00
8
8
  summary: A library that automatically caches all ActiveRecord::Base instances in memcache using the AdoccaMemcache gem.
9
9
  require_paths:
10
10
  - lib