couchrest_model 1.0.0 → 1.1.0.beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. data/.gitignore +1 -1
  2. data/Gemfile.lock +19 -20
  3. data/README.md +145 -20
  4. data/VERSION +1 -1
  5. data/couchrest_model.gemspec +2 -3
  6. data/history.txt +14 -0
  7. data/lib/couchrest/model/associations.rb +4 -4
  8. data/lib/couchrest/model/base.rb +5 -0
  9. data/lib/couchrest/model/callbacks.rb +1 -2
  10. data/lib/couchrest/model/collection.rb +1 -1
  11. data/lib/couchrest/model/designs/view.rb +486 -0
  12. data/lib/couchrest/model/designs.rb +81 -0
  13. data/lib/couchrest/model/document_queries.rb +1 -1
  14. data/lib/couchrest/model/persistence.rb +25 -16
  15. data/lib/couchrest/model/properties.rb +5 -1
  16. data/lib/couchrest/model/property.rb +2 -2
  17. data/lib/couchrest/model/proxyable.rb +152 -0
  18. data/lib/couchrest/model/typecast.rb +1 -1
  19. data/lib/couchrest/model/validations/casted_model.rb +3 -1
  20. data/lib/couchrest/model/validations/locale/en.yml +1 -1
  21. data/lib/couchrest/model/validations/uniqueness.rb +6 -7
  22. data/lib/couchrest/model/validations.rb +1 -0
  23. data/lib/couchrest/model/views.rb +11 -9
  24. data/lib/couchrest_model.rb +3 -0
  25. data/spec/couchrest/assocations_spec.rb +2 -2
  26. data/spec/couchrest/base_spec.rb +15 -1
  27. data/spec/couchrest/casted_model_spec.rb +30 -12
  28. data/spec/couchrest/class_proxy_spec.rb +2 -2
  29. data/spec/couchrest/collection_spec.rb +89 -0
  30. data/spec/couchrest/designs/view_spec.rb +766 -0
  31. data/spec/couchrest/designs_spec.rb +110 -0
  32. data/spec/couchrest/persistence_spec.rb +36 -7
  33. data/spec/couchrest/property_spec.rb +15 -0
  34. data/spec/couchrest/proxyable_spec.rb +329 -0
  35. data/spec/couchrest/{validations.rb → validations_spec.rb} +1 -3
  36. data/spec/couchrest/view_spec.rb +19 -91
  37. data/spec/fixtures/base.rb +8 -6
  38. data/spec/fixtures/more/article.rb +1 -1
  39. data/spec/fixtures/more/course.rb +4 -2
  40. metadata +21 -76
  41. data/lib/couchrest/model/view.rb +0 -190
@@ -27,6 +27,20 @@ describe "Model views" do
27
27
  end
28
28
 
29
29
  end
30
+
31
+ describe "#has_view?" do
32
+ it "should check the design doc" do
33
+ Article.design_doc.should_receive(:has_view?).with(:test).and_return(true)
34
+ Article.has_view?(:test).should be_true
35
+ end
36
+ end
37
+
38
+ describe "#can_reduce_view?" do
39
+ it "should check if view has a reduce method" do
40
+ Article.design_doc.should_receive(:can_reduce_view?).with(:test).and_return(true)
41
+ Article.can_reduce_view?(:test).should be_true
42
+ end
43
+ end
30
44
  end
31
45
 
32
46
  describe "a model with simple views and a default param" do
@@ -184,6 +198,11 @@ describe "Model views" do
184
198
  course.title.should eql('bbb')
185
199
  end
186
200
 
201
+ it "should perform a search for first when reduce method present" do
202
+ course = Course.first_from_view('by_active')
203
+ course.should_not be_nil
204
+ end
205
+
187
206
  end
188
207
 
189
208
  describe "a ducktype view" do
@@ -374,96 +393,5 @@ describe "Model views" do
374
393
  Article.design_doc["views"].keys.should include("by_updated_at")
375
394
  end
376
395
  end
377
-
378
- describe "with a collection" do
379
- before(:all) do
380
- reset_test_db!
381
- titles = ["very uniq one", "really interesting", "some fun",
382
- "really awesome", "crazy bob", "this rocks", "super rad"]
383
- titles.each_with_index do |title,i|
384
- a = Article.new(:title => title, :date => Date.today)
385
- a.save
386
- end
387
-
388
- titles = ["yesterday very uniq one", "yesterday really interesting", "yesterday some fun",
389
- "yesterday really awesome", "yesterday crazy bob", "yesterday this rocks"]
390
- titles.each_with_index do |title,i|
391
- a = Article.new(:title => title, :date => Date.today - 1)
392
- a.save
393
- end
394
- end
395
- require 'date'
396
- it "should return a proxy that looks like an array of 7 Article objects" do
397
- articles = Article.by_date :key => Date.today
398
- articles.class.should == Array
399
- articles.size.should == 7
400
- end
401
- it "should get a subset of articles using paginate" do
402
- articles = Article.by_date :key => Date.today
403
- articles.paginate(:page => 1, :per_page => 3).size.should == 3
404
- articles.paginate(:page => 2, :per_page => 3).size.should == 3
405
- articles.paginate(:page => 3, :per_page => 3).size.should == 1
406
- end
407
- it "should get all articles, a few at a time, using paginated each" do
408
- articles = Article.by_date :key => Date.today
409
- articles.paginated_each(:per_page => 3) do |a|
410
- a.should_not be_nil
411
- end
412
- end
413
- it "should provide a class method to access the collection directly" do
414
- articles = Article.collection_proxy_for('Article', 'by_date', :descending => true,
415
- :key => Date.today, :include_docs => true)
416
- articles.class.should == Array
417
- articles.size.should == 7
418
- end
419
- it "should provide a class method for paginate" do
420
- articles = Article.paginate(:design_doc => 'Article', :view_name => 'by_date',
421
- :per_page => 3, :descending => true, :key => Date.today, :include_docs => true)
422
- articles.size.should == 3
423
-
424
- articles = Article.paginate(:design_doc => 'Article', :view_name => 'by_date',
425
- :per_page => 3, :page => 2, :descending => true, :key => Date.today, :include_docs => true)
426
- articles.size.should == 3
427
-
428
- articles = Article.paginate(:design_doc => 'Article', :view_name => 'by_date',
429
- :per_page => 3, :page => 3, :descending => true, :key => Date.today, :include_docs => true)
430
- articles.size.should == 1
431
- end
432
- it "should provide a class method for paginated_each" do
433
- options = { :design_doc => 'Article', :view_name => 'by_date',
434
- :per_page => 3, :page => 1, :descending => true, :key => Date.today,
435
- :include_docs => true }
436
- Article.paginated_each(options) do |a|
437
- a.should_not be_nil
438
- end
439
- end
440
- it "should provide a class method to get a collection for a view" do
441
- articles = Article.find_all_article_details(:key => Date.today)
442
- articles.class.should == Array
443
- articles.size.should == 7
444
- end
445
- it "should raise an exception if design_doc is not provided" do
446
- lambda{Article.collection_proxy_for(nil, 'by_date')}.should raise_error
447
- lambda{Article.paginate(:view_name => 'by_date')}.should raise_error
448
- end
449
- it "should raise an exception if view_name is not provided" do
450
- lambda{Article.collection_proxy_for('Article', nil)}.should raise_error
451
- lambda{Article.paginate(:design_doc => 'Article')}.should raise_error
452
- end
453
- it "should be able to span multiple keys" do
454
- articles = Article.by_date :startkey => Date.today, :endkey => Date.today - 1
455
- articles.paginate(:page => 1, :per_page => 3).size.should == 3
456
- articles.paginate(:page => 2, :per_page => 3).size.should == 3
457
- articles.paginate(:page => 3, :per_page => 3).size.should == 3
458
- articles.paginate(:page => 4, :per_page => 3).size.should == 3
459
- articles.paginate(:page => 5, :per_page => 3).size.should == 1
460
- end
461
- it "should pass database parameter to pager" do
462
- proxy = mock(:proxy)
463
- proxy.stub!(:paginate)
464
- ::CouchRest::Model::Collection::CollectionProxy.should_receive(:new).with('database', anything(), anything(), anything(), anything()).and_return(proxy)
465
- Article.paginate(:design_doc => 'Article', :view_name => 'by_date', :database => 'database')
466
- end
467
- end
468
396
 
469
397
  end
@@ -20,20 +20,22 @@ end
20
20
  class WithCallBacks < CouchRest::Model::Base
21
21
  use_database TEST_SERVER.default_database
22
22
  property :name
23
- property :run_before_validate
24
- property :run_after_validate
23
+ property :run_before_validation
24
+ property :run_after_validation
25
25
  property :run_before_save
26
26
  property :run_after_save
27
27
  property :run_before_create
28
28
  property :run_after_create
29
29
  property :run_before_update
30
30
  property :run_after_update
31
+
32
+ validates_presence_of :run_before_validation
31
33
 
32
- before_validate do |object|
33
- object.run_before_validate = true
34
+ before_validation do |object|
35
+ object.run_before_validation = true
34
36
  end
35
- after_validate do |object|
36
- object.run_after_validate = true
37
+ after_validation do |object|
38
+ object.run_after_validation = true
37
39
  end
38
40
  before_save do |object|
39
41
  object.run_before_save = true
@@ -18,7 +18,7 @@ class Article < CouchRest::Model::Base
18
18
  :reduce =>
19
19
  "function(keys, values, rereduce) {
20
20
  return sum(values);
21
- }"
21
+ }"
22
22
 
23
23
  property :date, Date
24
24
  property :slug, :read_only => true
@@ -13,13 +13,15 @@ class Course < CouchRest::Model::Base
13
13
  property :hours, Integer
14
14
  property :profit, BigDecimal
15
15
  property :started_on, :type => Date
16
- property :updated_at, :type => DateTime
16
+ property :updated_at, DateTime
17
17
  property :active, :type => TrueClass
18
18
  property :very_active, :type => TrueClass
19
19
  property :klass, :type => Class
20
-
20
+
21
21
  view_by :title
22
22
  view_by :title, :active
23
23
  view_by :dept, :ducktype => true
24
24
 
25
+ view_by :active, :map => "function(d) { if (d['#{model_type_key}'] == 'Course' && d['active']) { emit(d['updated_at'], 1); }}", :reduce => "function(k,v,r) { return sum(v); }"
26
+
25
27
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: couchrest_model
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
5
- prerelease:
4
+ prerelease: true
6
5
  segments:
7
6
  - 1
7
+ - 1
8
8
  - 0
9
- - 0
10
- version: 1.0.0
9
+ - beta
10
+ version: 1.1.0.beta
11
11
  platform: ruby
12
12
  authors:
13
13
  - J. Chris Anderson
@@ -19,7 +19,7 @@ autorequire:
19
19
  bindir: bin
20
20
  cert_chain: []
21
21
 
22
- date: 2011-01-16 00:00:00 -02:00
22
+ date: 2011-01-16 00:00:00 +01:00
23
23
  default_executable:
24
24
  dependencies:
25
25
  - !ruby/object:Gem::Dependency
@@ -30,12 +30,11 @@ dependencies:
30
30
  requirements:
31
31
  - - ~>
32
32
  - !ruby/object:Gem::Version
33
- hash: 21
34
33
  segments:
35
34
  - 1
36
35
  - 0
37
- - 1
38
- version: 1.0.1
36
+ - 2
37
+ version: 1.0.2
39
38
  type: :runtime
40
39
  version_requirements: *id001
41
40
  - !ruby/object:Gem::Dependency
@@ -46,7 +45,6 @@ dependencies:
46
45
  requirements:
47
46
  - - ~>
48
47
  - !ruby/object:Gem::Version
49
- hash: 17
50
48
  segments:
51
49
  - 1
52
50
  - 15
@@ -61,7 +59,6 @@ dependencies:
61
59
  requirements:
62
60
  - - ~>
63
61
  - !ruby/object:Gem::Version
64
- hash: 7
65
62
  segments:
66
63
  - 3
67
64
  - 0
@@ -77,7 +74,6 @@ dependencies:
77
74
  requirements:
78
75
  - - ~>
79
76
  - !ruby/object:Gem::Version
80
- hash: 63
81
77
  segments:
82
78
  - 0
83
79
  - 3
@@ -93,7 +89,6 @@ dependencies:
93
89
  requirements:
94
90
  - - ~>
95
91
  - !ruby/object:Gem::Version
96
- hash: 7
97
92
  segments:
98
93
  - 3
99
94
  - 0
@@ -109,46 +104,28 @@ dependencies:
109
104
  requirements:
110
105
  - - ">="
111
106
  - !ruby/object:Gem::Version
112
- hash: 15
113
- segments:
114
- - 2
115
- - 0
116
- - 0
117
- version: 2.0.0
118
- type: :runtime
119
- version_requirements: *id006
120
- - !ruby/object:Gem::Dependency
121
- name: rspec
122
- prerelease: false
123
- requirement: &id007 !ruby/object:Gem::Requirement
124
- none: false
125
- requirements:
126
- - - ">="
127
- - !ruby/object:Gem::Version
128
- hash: 15
129
107
  segments:
130
108
  - 2
131
109
  - 0
132
110
  - 0
133
111
  version: 2.0.0
134
112
  type: :development
135
- version_requirements: *id007
113
+ version_requirements: *id006
136
114
  - !ruby/object:Gem::Dependency
137
115
  name: rack-test
138
116
  prerelease: false
139
- requirement: &id008 !ruby/object:Gem::Requirement
117
+ requirement: &id007 !ruby/object:Gem::Requirement
140
118
  none: false
141
119
  requirements:
142
120
  - - ">="
143
121
  - !ruby/object:Gem::Version
144
- hash: 5
145
122
  segments:
146
123
  - 0
147
124
  - 5
148
125
  - 7
149
126
  version: 0.5.7
150
127
  type: :development
151
- version_requirements: *id008
128
+ version_requirements: *id007
152
129
  description: CouchRest Model provides aditional features to the standard CouchRest Document class such as properties, view designs, associations, callbacks, typecasting and validations.
153
130
  email: jchris@apache.org
154
131
  executables: []
@@ -182,6 +159,8 @@ files:
182
159
  - lib/couchrest/model/collection.rb
183
160
  - lib/couchrest/model/configuration.rb
184
161
  - lib/couchrest/model/design_doc.rb
162
+ - lib/couchrest/model/designs.rb
163
+ - lib/couchrest/model/designs/view.rb
185
164
  - lib/couchrest/model/document_queries.rb
186
165
  - lib/couchrest/model/errors.rb
187
166
  - lib/couchrest/model/extended_attachments.rb
@@ -189,6 +168,7 @@ files:
189
168
  - lib/couchrest/model/properties.rb
190
169
  - lib/couchrest/model/property.rb
191
170
  - lib/couchrest/model/property_protection.rb
171
+ - lib/couchrest/model/proxyable.rb
192
172
  - lib/couchrest/model/support/couchrest.rb
193
173
  - lib/couchrest/model/support/hash.rb
194
174
  - lib/couchrest/model/typecast.rb
@@ -196,7 +176,6 @@ files:
196
176
  - lib/couchrest/model/validations/casted_model.rb
197
177
  - lib/couchrest/model/validations/locale/en.yml
198
178
  - lib/couchrest/model/validations/uniqueness.rb
199
- - lib/couchrest/model/view.rb
200
179
  - lib/couchrest/model/views.rb
201
180
  - lib/couchrest/railtie.rb
202
181
  - lib/couchrest_model.rb
@@ -210,13 +189,17 @@ files:
210
189
  - spec/couchrest/casted_model_spec.rb
211
190
  - spec/couchrest/casted_spec.rb
212
191
  - spec/couchrest/class_proxy_spec.rb
192
+ - spec/couchrest/collection_spec.rb
213
193
  - spec/couchrest/configuration_spec.rb
194
+ - spec/couchrest/designs/view_spec.rb
195
+ - spec/couchrest/designs_spec.rb
214
196
  - spec/couchrest/inherited_spec.rb
215
197
  - spec/couchrest/persistence_spec.rb
216
198
  - spec/couchrest/property_protection_spec.rb
217
199
  - spec/couchrest/property_spec.rb
200
+ - spec/couchrest/proxyable_spec.rb
218
201
  - spec/couchrest/subclass_spec.rb
219
- - spec/couchrest/validations.rb
202
+ - spec/couchrest/validations_spec.rb
220
203
  - spec/couchrest/view_spec.rb
221
204
  - spec/fixtures/attachments/README
222
205
  - spec/fixtures/attachments/couchdb.png
@@ -255,7 +238,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
255
238
  requirements:
256
239
  - - ">="
257
240
  - !ruby/object:Gem::Version
258
- hash: 3
259
241
  segments:
260
242
  - 0
261
243
  version: "0"
@@ -264,7 +246,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
264
246
  requirements:
265
247
  - - ">"
266
248
  - !ruby/object:Gem::Version
267
- hash: 25
268
249
  segments:
269
250
  - 1
270
251
  - 3
@@ -273,45 +254,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
273
254
  requirements: []
274
255
 
275
256
  rubyforge_project:
276
- rubygems_version: 1.4.2
257
+ rubygems_version: 1.3.7
277
258
  signing_key:
278
259
  specification_version: 3
279
260
  summary: Extends the CouchRest Document for advanced modelling.
280
- test_files:
281
- - spec/couchrest/assocations_spec.rb
282
- - spec/couchrest/attachment_spec.rb
283
- - spec/couchrest/base_spec.rb
284
- - spec/couchrest/casted_model_spec.rb
285
- - spec/couchrest/casted_spec.rb
286
- - spec/couchrest/class_proxy_spec.rb
287
- - spec/couchrest/configuration_spec.rb
288
- - spec/couchrest/inherited_spec.rb
289
- - spec/couchrest/persistence_spec.rb
290
- - spec/couchrest/property_protection_spec.rb
291
- - spec/couchrest/property_spec.rb
292
- - spec/couchrest/subclass_spec.rb
293
- - spec/couchrest/validations.rb
294
- - spec/couchrest/view_spec.rb
295
- - spec/fixtures/attachments/README
296
- - spec/fixtures/attachments/couchdb.png
297
- - spec/fixtures/attachments/test.html
298
- - spec/fixtures/base.rb
299
- - spec/fixtures/more/article.rb
300
- - spec/fixtures/more/card.rb
301
- - spec/fixtures/more/cat.rb
302
- - spec/fixtures/more/client.rb
303
- - spec/fixtures/more/course.rb
304
- - spec/fixtures/more/event.rb
305
- - spec/fixtures/more/invoice.rb
306
- - spec/fixtures/more/person.rb
307
- - spec/fixtures/more/question.rb
308
- - spec/fixtures/more/sale_entry.rb
309
- - spec/fixtures/more/sale_invoice.rb
310
- - spec/fixtures/more/service.rb
311
- - spec/fixtures/more/user.rb
312
- - spec/fixtures/views/lib.js
313
- - spec/fixtures/views/test_view/lib.js
314
- - spec/fixtures/views/test_view/only-map.js
315
- - spec/fixtures/views/test_view/test-map.js
316
- - spec/fixtures/views/test_view/test-reduce.js
317
- - spec/spec_helper.rb
261
+ test_files: []
262
+
@@ -1,190 +0,0 @@
1
-
2
- #### NOTE Work in progress! Not yet used!
3
-
4
- module CouchRest
5
- module Model
6
-
7
- # A proxy class that allows view queries to be created using
8
- # chained method calls. After each call a new instance of the method
9
- # is created based on the original in a similar fashion to ruby's sequel
10
- # library, or Rails 3's Arel.
11
- #
12
- # CouchDB views have inherent limitations, so joins and filters as used in
13
- # a normal relational database are not possible. At least not yet!
14
- #
15
- #
16
- #
17
- class View
18
-
19
- attr_accessor :query, :design, :database, :name
20
-
21
- # Initialize a new View object. This method should not be called from outside CouchRest Model.
22
- def initialize(parent, new_query = {}, name = nil)
23
- if parent.is_a? Base
24
- raise "Name must be provided for view to be initialized" if name.nil?
25
- @name = name
26
- @database = parent.database
27
- @query = { :reduce => false }
28
- elsif parent.is_a? View
29
- @database = parent.database
30
- @query = parent.query.dup
31
- else
32
- raise "View cannot be initialized without a parent Model or View"
33
- end
34
- @query.update(new_query)
35
- super
36
- end
37
-
38
-
39
- # == View Execution Methods
40
- #
41
- # Send a request to the CouchDB database using the current query values.
42
-
43
- # Inmediatly send a request to the database for all documents provided by the query.
44
- #
45
- def all(&block)
46
- args = include_docs.query
47
-
48
- end
49
-
50
- # Inmediatly send a request for the first result of the dataset. This will override
51
- # any limit set in the view previously.
52
- def first(&block)
53
- args = limit(1).include_docs.query
54
-
55
- end
56
-
57
- def info
58
-
59
- end
60
-
61
- def offset
62
-
63
- end
64
-
65
- def total_rows
66
-
67
- end
68
-
69
- def rows
70
-
71
- end
72
-
73
-
74
- # == View Filter Methods
75
- #
76
- # View filters return an copy of the view instance with the query
77
- # modified appropriatly. Errors will be raised if the methods
78
- # are combined in an incorrect fashion.
79
- #
80
-
81
-
82
- # Find all entries in the index whose key matches the value provided.
83
- #
84
- # Cannot be used when the +#startkey+ or +#endkey+ have been set.
85
- def key(value)
86
- raise "View#key cannot be used when startkey or endkey have been set" unless query[:startkey].nil? && query[:endkey].nil?
87
- update_query(:key => value)
88
- end
89
-
90
- # Find all index keys that start with the value provided. May or may not be used in
91
- # conjunction with the +endkey+ option.
92
- #
93
- # When the +#descending+ option is used (not the default), the start and end keys should
94
- # be reversed.
95
- #
96
- # Cannot be used if the key has been set.
97
- def startkey(value)
98
- raise "View#startkey cannot be used when key has been set" unless query[:key].nil?
99
- update_query(:startkey => value)
100
- end
101
-
102
- # The result set should start from the position of the provided document.
103
- # The value may be provided as an object that responds to the +#id+ call
104
- # or a string.
105
- def startkey_doc(value)
106
- update_query(:startkey_docid => value.is_a?(String) ? value : value.id
107
- end
108
-
109
- # The opposite of +#startkey+, finds all index entries whose key is before the value specified.
110
- #
111
- # See the +#startkey+ method for more details and the +#inclusive_end+ option.
112
- def endkey(value)
113
- raise "View#endkey cannot be used when key has been set" unless query[:key].nil?
114
- update_query(:endkey => value)
115
- end
116
-
117
- # The result set should end at the position of the provided document.
118
- # The value may be provided as an object that responds to the +#id+ call
119
- # or a string.
120
- def endkey_doc(value)
121
- update_query(:endkey_docid => value.is_a?(String) ? value : value.id
122
- end
123
-
124
-
125
- # The results should be provided in descending order.
126
- #
127
- # Descending is false by default, this method will enable it and cannot be undone.
128
- def descending
129
- update_query(:descending => true)
130
- end
131
-
132
- # Limit the result set to the value supplied.
133
- def limit(value)
134
- update_query(:limit => value)
135
- end
136
-
137
- # Skip the number of entries in the index specified by value. This would be
138
- # the equivilent of an offset in SQL.
139
- #
140
- # The CouchDB documentation states that the skip option should not be used
141
- # with large data sets as it is inefficient. Use the +startkey_doc+ method
142
- # instead to skip ranges efficiently.
143
- def skip(value = 0)
144
- update_query(:skip => value)
145
- end
146
-
147
- # Use the reduce function on the view. If none is available this method will fail.
148
- def reduce
149
- update_query(:reduce => true)
150
- end
151
-
152
- # Control whether the reduce function reduces to a set of distinct keys or to a single
153
- # result row.
154
- #
155
- # By default the value is false, and can only be set when the view's +#reduce+ option
156
- # has been set.
157
- def group
158
- raise "View#reduce must have been set before grouping is permitted" unless query[:reduce]
159
- update_query(:group => true)
160
- end
161
-
162
- def group_level(value)
163
- raise "View#reduce and View#group must have been set before group_level is called" unless query[:reduce] && query[:group]
164
- update_query(:group_level => value.to_i)
165
- end
166
-
167
-
168
- protected
169
-
170
- def update_query(new_query = {})
171
- self.class.new(self, new_query)
172
- end
173
-
174
- # Used internally to ensure that docs are provided. Should not be used outside of
175
- # the view class under normal circumstances.
176
- def include_docs
177
- raise "Documents cannot be returned from a view that is prepared for a reduce" if query[:reduce]
178
- update_query(:include_docs => true)
179
- end
180
-
181
-
182
- def execute(&block)
183
-
184
-
185
- end
186
-
187
-
188
- end
189
- end
190
- end