| Class | CouchPotato::View::ModelViewSpec |
| In: |
lib/couch_potato/view/model_view_spec.rb
|
| Parent: | CouchPotato::View::BaseViewSpec |
A view to return model instances by searching its properties
example:
view :my_view, :key => :name
# File lib/couch_potato/view/model_view_spec.rb, line 13
13: def map_function
14: "function(doc) {
15: emit(#{formatted_key(key)}, null);
16: }"
17: end
# File lib/couch_potato/view/model_view_spec.rb, line 19
19: def process_results(results)
20: results['rows'].map do |row|
21: klass.json_create row['doc']
22: end
23: end