1
votes

I'm using Ember 1.0 and Ember-Data1.0beta. Typically, Ember knows what URL to submit a resource to because in the route you define the model. For instance:

model: ->
  @store.createRecord('organization')

or:

model: (params) ->
  @modelFor('organization')

What do you do if the form isn't tied to the route? Specifically, I have a list of comments, each of which has two forms, an up-vote form and a down-vote form. These are rendered through a component like so:

// comment.emblem
. . . .
poll-vote commentId=comment.id
. . . .

// components/poll-vote.emblem
form submit='up-vote'
  input type="hidden" valueBinding="commentId" value=commentId
  input type="hidden" valueBinding="value" value="1"
  Whistlr.Button
form submit='down-vote'
  input type="hidden" valueBinding="commentId" value=commentId
  input type="hidden" valueBinding="value" value="-1"
  Whistlr.Button

How can I get Ember to submit these forms to the route /votes? I know this is possible with some hand-coded AJAX, but I suspect there some way to get Ember's store to do so.

1

1 Answers

1
votes

Unfortunately there is no way to get Ember Data to do this. Ember Data is very strict in what it does. It's entire job is record management client side. Unless you are creating an organization record and then using save on it, it's unfortunately out of the scope of ED.

Good luck!