{"issue":{"milestone":null,"user":{"id":75257,"login":"dgdosen","url":"https://api.github.com/users/dgdosen","avatar_url":"https://secure.gravatar.com/avatar/21a5b3c309f75cad3a766fc8ab85c23f?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"21a5b3c309f75cad3a766fc8ab85c23f"},"title":"Guidance on Nested Models","created_at":"2011-12-14T22:13:23Z","updated_at":"2011-12-20T05:33:17Z","labels":[],"state":"open","id":2559724,"pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"html_url":"https://github.com/codebrew/backbone-rails/issues/79","closed_at":null,"body":"Hi all;\r\n\r\nI'm using backbone-rails in a nested model example (say I have a collection of Activities, and each can have a collection of Pomodori)\r\n\r\nI work with that app on a single page.  I can load and create a series of nested views to display the data I want, but now I'm stuck when trying to perform CRUD operations on that data.  \r\n\r\nFor example - say I change an attribute on my outer object, and send that data to the server.  Here's what that json looks like **(look at pomodori_attributes)**:\r\n`{\"activity\"=>{\"name\"=>\"testupdate\", \"user_id\"=>1, \"id\"=>3, \"pomodori\"=>[{\"activity_id\"=>3, \"break_length\"=>4, \"completed\"=>false, \"id\"=>12, \"length\"=>25, \"location_id\"=>nil, \"note\"=>\"test444\", \"start_date_time\"=>\"2011-12-15T00:00:00Z\"}], \"pomodori_attributes\"=>[{\"start_date_time\"=>\"2011-12-15T00:00:00Z\", \"completed\"=>false, \"note\"=>\"test444\", \"break_length\"=>4, \"activity_id\"=>3, \"id\"=>12, \"length\"=>25, \"location_id\"=>nil}]}, \"user_id\"=>\"1\", \"id\"=>\"3\"}\r\nart_date_time\"=>\"2011-12-15T00:00:00Z\"}]}, \"user_id\"=>\"1\", \"id\"=>\"3\"}`\r\n\r\nwhat the server wants, is a hash of nested objects (although there's only one in this example (look at pomodori_attributes):\r\n`{\"utf8\"=>\"✓\", \"authenticity_token\"=>\"iv9wYvgqLt3nldVOX4AeAifpFaSHIfEj85MsPUaMiAw=\", \"activity\"=>{\"name\"=>\"test\", \"pomodori_attributes\"=>{\"0\"=>{\"_destroy\"=>\"\", \"start_date_time\"=>\"2011-12-15 00:00:00\", \"length\"=>\"25\", \"completed\"=>\"0\", \"note\"=>\"test444\", \"break_length\"=>\"4\", \"id\"=>\"12\"}}}, \"commit\"=>\"Update Activity\", \"user_id\"=>\"1\", \"id\"=>\"3\"}\r\n\"location_id\"=>nil, \"note\"=>\"test\", \"start_date_time\"=>\"2011-12-15T00:00:00Z\"}]}, \"user_id\"=>\"1\", \"id\"=>\"3\"}`\r\n\r\nany guidance on how to get my json, on an update, to look like it should for the server to accept it?\r\n\r\nThanks for any help.\r\n\\\r\n","number":79,"url":"https://api.github.com/repos/codebrew/backbone-rails/issues/79","comments":0,"assignee":null},"action":"reopened"}