brendan-skynet 0.9.315 → 0.9.316
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/skynet/active_record_extensions.rb +9 -3
- data/lib/skynet/version.rb +1 -1
- data/skynet.gemspec +1 -1
- metadata +1 -1
@@ -3,6 +3,11 @@ module Skynet::ActiveRecordExtensions
|
|
3
3
|
module ClassMethods
|
4
4
|
|
5
5
|
def distributed_find(*args)
|
6
|
+
if args.last.is_a?(Hash)
|
7
|
+
options = args.pop.dup
|
8
|
+
options[:conditions] = sanitize_sql(options[:conditions]) if options[:conditions]
|
9
|
+
args << options
|
10
|
+
end
|
6
11
|
all = ActiveRecord::Mapreduce.find(*args)
|
7
12
|
all.model_class = self
|
8
13
|
all
|
@@ -193,7 +198,7 @@ module ActiveRecord
|
|
193
198
|
job.run
|
194
199
|
end
|
195
200
|
|
196
|
-
def map(klass_or_method=nil
|
201
|
+
def map(klass_or_method=nil, *arguments, &block)
|
197
202
|
klass_or_method ||= model_class
|
198
203
|
log = Skynet::Logger.get
|
199
204
|
|
@@ -208,7 +213,8 @@ module ActiveRecord
|
|
208
213
|
if block_given?
|
209
214
|
batch_item << block
|
210
215
|
else
|
211
|
-
batch_item << "#{klass_or_method}"
|
216
|
+
batch_item << "#{klass_or_method}"
|
217
|
+
batch_item << arguments
|
212
218
|
end
|
213
219
|
batches << batch_item
|
214
220
|
if batches.size >= MAX_BATCHES_PER_JOB
|
@@ -267,7 +273,7 @@ module ActiveRecord
|
|
267
273
|
if data[4].kind_of?(String)
|
268
274
|
if ar_object.respond_to?(data[4].to_sym)
|
269
275
|
# log.error "CALLING #{data[4]} on #{ar_object.class}:#{ar_object.id}"
|
270
|
-
ar_object.send(data[4].to_sym)
|
276
|
+
ar_object.send(data[4].to_sym, *data[5])
|
271
277
|
else
|
272
278
|
begin
|
273
279
|
data[4].constantize.each(ar_object)
|
data/lib/skynet/version.rb
CHANGED
data/skynet.gemspec
CHANGED