lib/ruote/dm/storage.rb in ruote-dm-2.1.7 vs lib/ruote/dm/storage.rb in ruote-dm-2.1.9
- old
+ new
@@ -226,12 +226,15 @@
cr[:ide.like] = "%!#{wfid}" if wfid
cr[:offset] = offset if offset
cr[:limit] = limit if limit
cr[:participant_name] = pname if pname
- criteria.each do |k, v|
- cr[:doc.like] = "%\"#{k}\":#{Rufus::Json.encode(v)}%"
+ likes = criteria.collect do |k, v|
+ "%\"#{k}\":#{Rufus::Json.encode(v)}%"
end
+ cr[:conditions] = [
+ ([ 'doc LIKE ?' ] * likes.size).join(' AND '), *likes
+ ] unless likes.empty?
Document.all(cr).collect { |d|
Ruote::Workitem.new(Rufus::Json.decode(d.doc))
}
end