You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the following switch, couch potato only creates a single design document for all views:
84
+
85
+
```ruby
86
+
CouchPotato::Config.single_design_document =true
87
+
```
88
+
83
89
If you are using more than one database from your app, you can create aliases:
84
90
85
91
```ruby
@@ -95,6 +101,7 @@ Create a `config/couchdb.yml`:
95
101
default: &default
96
102
split_design_documents_per_view: true # optional, default is false
97
103
digest_view_names: true # optional, default is false
104
+
single_design_document: true # optional, default is false
98
105
default_language: :erlang # optional, default is javascript
99
106
database_host: "http://127.0.0.1:5984"
100
107
@@ -299,7 +306,7 @@ user.valid? # => false
299
306
user.errors[:name] # => ['can't be blank']
300
307
```
301
308
302
-
#### Finding stuff / views / lists
309
+
#### Finding stuff / views
303
310
304
311
In order to find data in your CouchDB you have to create a [view](http://books.couchdb.org/relax/design-documents/views) first. Couch Potato offers you to create and manage those views for you. All you have to do is declare them in your classes:
305
312
@@ -403,14 +410,6 @@ class User
403
410
end
404
411
```
405
412
406
-
commonJS modules can also be used in custom views:
If you don't want the results to be converted into models the raw view is your friend:
415
414
416
415
```ruby
@@ -450,49 +449,6 @@ You can pass in your own view specifications by passing in `:type => MyViewSpecC
450
449
451
450
If turned on, Couch Potato will append an MD5 digest of the map function to each view name. This makes sure (together with split_design_documents_per_view) that no views/design documents are ever updated. Instead, new ones are created. Since reindexing can take a long time once your database is larger, you want to avoid blocking your app while CouchDB is busy. Instead, you create a new view, warm it up, and only then start using it.
452
451
453
-
##### Lists
454
-
455
-
CouchPotato also supports [CouchDB lists](http://books.couchdb.org/relax/design-documents/lists). With lists you can process the result of a view query with another JavaScript function. This can be useful for example if you want to filter your results, or add some data to each document.
# returns all the classes that include the CouchPotato::View::CustomViews module
46
+
defself.views
47
+
@views ||= []
48
+
@views
49
+
end
50
+
43
51
# Returns a database instance which you can then use to create objects and query views. You have to set the CouchPotato::Config.database_name before this works.
0 commit comments