summaryrefslogtreecommitdiff
path: root/core/lib
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2013-01-03 10:39:02 +0100
committerAzul <azul@leap.se>2013-01-03 10:39:02 +0100
commit5732c2fa48cf4af9af122ca5366f9ffffe5f22fb (patch)
treecefc7d18441dbaee6f1e217674be765b21a860e8 /core/lib
parent04376c286daee0165f6544ecdafaa645aa7695c0 (diff)
adding default reduce function to couch views read from files
Diffstat (limited to 'core/lib')
-rw-r--r--core/lib/extensions/couchrest.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/core/lib/extensions/couchrest.rb b/core/lib/extensions/couchrest.rb
index 0dca632..5938df4 100644
--- a/core/lib/extensions/couchrest.rb
+++ b/core/lib/extensions/couchrest.rb
@@ -13,7 +13,9 @@ module CouchRest::Model::Designs
Dir.glob("#{dir}/*.js") do |js|
name = File.basename(js, '.js')
file = File.open(js, 'r')
- view name.to_sym, :map => file.read
+ view name.to_sym,
+ :map => file.read,
+ :reduce => "function(key, values, rereduce) { return sum(values); }"
end
end
end