Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve documentation #89

Merged
merged 2 commits into from
Dec 11, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ This will not replace de default find view.
```ruby
class User < Dolly::Document
database_name 'db'
set_design_doc 'dolly' #defaults to 'dolly'

property :name, :surname, :address
property :date_of_birth, class_name: Date, default: Date.today
Expand All @@ -71,8 +70,9 @@ User.all #Dolly::Collection #<#User...>, <#User...>
user = User.find "a1b2d3e" #<#User...>
user.name

#Return a User object based on the custom view.
user = User.view 'view_name', {key: ["a", "b", "c"], reduce: true}
#Return a User object based on the custom view. `include_docs` is always true for this method.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is a User object returned or a json string?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JSON String, that's why I added the from_json call, as it previously seemed to indicate you'd be getting a User instead of a String.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha.

response = User.view '_design/<design_document_name>/_view/<view_name>', {key: <key>, reduce: true}
user = User.new.from_json response


# Save doc
Expand Down