diff options
author | Azul <azul@leap.se> | 2013-01-03 10:39:02 +0100 |
---|---|---|
committer | Azul <azul@leap.se> | 2013-01-03 10:39:02 +0100 |
commit | 5732c2fa48cf4af9af122ca5366f9ffffe5f22fb (patch) | |
tree | cefc7d18441dbaee6f1e217674be765b21a860e8 | |
parent | 04376c286daee0165f6544ecdafaa645aa7695c0 (diff) |
adding default reduce function to couch views read from files
-rw-r--r-- | core/lib/extensions/couchrest.rb | 4 |
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 |