getoutreach / epf

A framework for keeping your Ember.js apps in sync.
http://epf.io
MIT License
369 stars 33 forks source link

Enhancements to RPC, and make server-set meta available. #112

Closed lastobelus closed 10 years ago

lastobelus commented 10 years ago
  1. allow RPC calls against the collection (ie, matching the following import route in a rails api):

    resources :widget do
     collection do
       post 'import' => :import
     end
    end
  2. Make meta property set on the server always available. The implementation is somewhat ugly, but the result is that whatever you do that hits the server, the meta info will be available in the then of the promise. In the case of a flush, each of the models in the result set passed to the then of the flush will have the meta that was set by its (last) operation. In the case of a query, the meta will be set on the model array. It is set as bare javascript property, not as an ember property. Should I change this?
  3. Allow choosing an HTTP method for RPC (by setting _method in params)

My original needs involved all three of these things, but I think they are orthogonal, and if you want I can make separate branches & pull requests for them.

lastobelus commented 10 years ago

Thanks a lot for looking at this! I have to use this in my app a bit and then I will attempt to address your comments.

lastobelus commented 10 years ago

I have been using this in my app without problems.

lastobelus commented 10 years ago

I rebased this on current master.

ghempton commented 10 years ago

I just manually merged these commits in with one change: instead of taking the method directly as the 4th parameter, remoteCall now takes a hash of options. To specify the method: remoteCall(post, 'submit', {token: 'asdas'}, {type: 'PUT'});. The reason for calling it type instead of method is purely to align with jquery ajax.

Thanks for the PR and sorry it took so long to merge!