| Class | CouchPotato::View::CustomViewSpec |
| In: |
lib/couch_potato/view/custom_view_spec.rb
|
| Parent: | CouchPotato::View::BaseViewSpec |
a view for custom map/reduce functions that still returns model instances
example:
view :my_custom_view, :map => "function(doc) { emit(doc._id, null); }", :include_docs => true, :type => :custom, :reduce => nil
# File lib/couch_potato/view/custom_view_spec.rb, line 8
8: def map_function
9: options[:map]
10: end
# File lib/couch_potato/view/custom_view_spec.rb, line 20
20: def process_results(results)
21: results['rows'].map do |row|
22: klass.json_create row['doc'] || row['value'].merge(:_id => row['id'])
23: end
24: end
# File lib/couch_potato/view/custom_view_spec.rb, line 12
12: def reduce_function
13: options[:reduce]
14: end