CachedSupermodel 0.1.2.7 → 0.1.2.8
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.
- data/Rakefile +1 -1
- data/lib/cs_active_record.rb +7 -7
- metadata +1 -1
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.
|
7
|
+
Hoe.new('CachedSupermodel', '0.1.2.8') 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'
|
data/lib/cs_active_record.rb
CHANGED
@@ -75,6 +75,7 @@ def self.#{finder}_get_ids(*args)
|
|
75
75
|
key_type = columns_hash[self.primary_key].type
|
76
76
|
|
77
77
|
rest = args[attributes.size..-1]
|
78
|
+
hash_args = rest.first || {}
|
78
79
|
cache_value(['CachedSupermodel:' + self.name + ':#{finder}:' + normal_arguments.inspect, rest.inspect]) do
|
79
80
|
params = []
|
80
81
|
query = 'SELECT ' + self.primary_key.to_s + ' from ' + self.table_name
|
@@ -86,23 +87,22 @@ def self.#{finder}_get_ids(*args)
|
|
86
87
|
|
87
88
|
query << (' WHERE ' + where.join(' AND '))
|
88
89
|
|
89
|
-
if
|
90
|
-
query << ' ORDER BY
|
91
|
-
params << rest[:order]
|
90
|
+
if hash_args.include?(:order)
|
91
|
+
query << ' ORDER BY ' << hash_args[:order]
|
92
92
|
end
|
93
93
|
|
94
94
|
if find_all
|
95
|
-
if
|
95
|
+
if hash_args.include?(:limit)
|
96
96
|
query << ' LIMIT ?'
|
97
|
-
params <<
|
97
|
+
params << hash_args[:limit]
|
98
98
|
end
|
99
99
|
else
|
100
100
|
query << ' LIMIT 1'
|
101
101
|
end
|
102
102
|
|
103
|
-
if
|
103
|
+
if hash_args.include?(:offset)
|
104
104
|
query << ' OFFSET ?'
|
105
|
-
params <<
|
105
|
+
params << hash_args[:offset]
|
106
106
|
end
|
107
107
|
|
108
108
|
rval = self.connection.select_all(self.sanitizeSQL([query, *params])).collect{ |row|
|
metadata
CHANGED
@@ -3,7 +3,7 @@ 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.
|
6
|
+
version: 0.1.2.8
|
7
7
|
date: 2007-08-23 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:
|