{"action":"created","issue":{"url":"https://api.github.com/repos/emberjs/data/issues/2487","labels_url":"https://api.github.com/repos/emberjs/data/issues/2487/labels{/name}","comments_url":"https://api.github.com/repos/emberjs/data/issues/2487/comments","events_url":"https://api.github.com/repos/emberjs/data/issues/2487/events","html_url":"https://github.com/emberjs/data/issues/2487","id":49237982,"number":2487,"title":"Saving with EmbeddedRecordsMixin does not update related models dirty attributes","user":{"login":"DEfusion","id":117200,"avatar_url":"https://avatars.githubusercontent.com/u/117200?v=3","gravatar_id":"","url":"https://api.github.com/users/DEfusion","html_url":"https://github.com/DEfusion","followers_url":"https://api.github.com/users/DEfusion/followers","following_url":"https://api.github.com/users/DEfusion/following{/other_user}","gists_url":"https://api.github.com/users/DEfusion/gists{/gist_id}","starred_url":"https://api.github.com/users/DEfusion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DEfusion/subscriptions","organizations_url":"https://api.github.com/users/DEfusion/orgs","repos_url":"https://api.github.com/users/DEfusion/repos","events_url":"https://api.github.com/users/DEfusion/events{/privacy}","received_events_url":"https://api.github.com/users/DEfusion/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2014-11-18T14:35:27Z","updated_at":"2015-05-25T07:22:19Z","closed_at":null,"body":"I created a demo (http://jsbin.com/zejala/6/edit?js,output) simulating saving `hasMany` related models via `DS.EmbeddedRecordsMixin` and Rails' `accepts_nested_attributes_for`.\r\n\r\nNo matter what way the serializer is configured in Ember dirty attributes of the relationships records are not updated with those from the response, non dirty attributes _are_ updated though.\r\n\r\nThe only workaround I have found is to manually go through and mark them individually as `willCommit` and then `didCommit` by overriding `save` on the model - I tried doing this in the serializer for better encapsulation but couldn't get it to work.\r\n\r\nIf I've specified `serialize: 'records'` for my serializer when using `EmbeddedRecordsMixin` I would expect those records to be automatically set as saving/saved etc. along with the parent according to the normal save flow."},"comment":{"url":"https://api.github.com/repos/emberjs/data/issues/comments/105152757","html_url":"https://github.com/emberjs/data/issues/2487#issuecomment-105152757","issue_url":"https://api.github.com/repos/emberjs/data/issues/2487","id":105152757,"user":{"login":"perlun","id":630613,"avatar_url":"https://avatars.githubusercontent.com/u/630613?v=3","gravatar_id":"","url":"https://api.github.com/users/perlun","html_url":"https://github.com/perlun","followers_url":"https://api.github.com/users/perlun/followers","following_url":"https://api.github.com/users/perlun/following{/other_user}","gists_url":"https://api.github.com/users/perlun/gists{/gist_id}","starred_url":"https://api.github.com/users/perlun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/perlun/subscriptions","organizations_url":"https://api.github.com/users/perlun/orgs","repos_url":"https://api.github.com/users/perlun/repos","events_url":"https://api.github.com/users/perlun/events{/privacy}","received_events_url":"https://api.github.com/users/perlun/received_events","type":"User","site_admin":false},"created_at":"2015-05-25T07:22:19Z","updated_at":"2015-05-25T07:22:19Z","body":":+1:, this should be fixed. It's definitely a bug with the mixin IMHO. I adapted the @lolmaus approach now (`willCommit`, clear `_attributes`, `didCommit`) but it definitely feels like a hack to have to do this manually.\r\n\r\n/cc @emilgrip"}}