Zatvobor / ember-couchdb-kit

An Ember.js adapter for Apache CouchDB
MIT License
43 stars 13 forks source link

Find by view_name #36

Open Zatvobor opened 11 years ago

Zatvobor commented 11 years ago

In order to simplify fetching entities from views We should provide simple convenience for that

for instance:

EmberApp.Task.find({type: "view", designDoc: 'tasks', viewName: "by_assignee", options: 'include_docs=true&key="%@"'.fmt(@get('email'))})

could be simplified as:

EmberApp.Task.view_by('tasks/by_assignee', key: @get('email'))

in additional:

EmberApp.Task.view('all')
# as equivalent for: EmberApp.Task.find_by_view('tasks/all')
OpakAlex commented 11 years ago

use DS.Model.reopenClass