You can clone with
HTTPS or Subversion.
Here is part of our app:
createMeeting: (data) ->
topic = @get 'topicValue'
startsAt = @get 'startsAtValue'
endsAt = @get 'endsAtValue'
meeting = Radium.Meeting.createRecord data
All we want to do is commit the meeting. It seems awkward to have to call meeting.store.commit(). The other solution is to call @get('store') since there is an injection that setups store on the controllers IIRC and call store.commit(). Calling store.commit() will commit all the records. Sometimes you don't want that. Would it be possible to create DS.Model.commit() which would add the model instance to a new transaction and commit the transaction? I think this is a better solution than having to track store through every controller in the application.
Yeah actually you have to create your own transaction from the store, add the model into it and commit the transaction. Perhaps a shortcut like you propose may be usefull. But we have to keep in mind that we have to add eventual associations too.
ya i was going to say perhaps model could have a commit function that wrapped up creating a transaction, using that transactions createRecord and then commit all in one go
I use meeting.transaction.commit() personally, although the vast majority of the time it's usually still the default transaction
The underlying issue is that relationships make these semantics very complex, as you don't only save a single record, you might want to also store related records that changed as well. I do agree that the transaction api is not super nice and we will probably be making changes once ember-data is more stable.
Should be addressed by 77c8d0b.