{"action":"closed","issue":{"url":"https://api.github.com/repos/ga-wdi-exercises/project2/issues/629","repository_url":"https://api.github.com/repos/ga-wdi-exercises/project2","labels_url":"https://api.github.com/repos/ga-wdi-exercises/project2/issues/629/labels{/name}","comments_url":"https://api.github.com/repos/ga-wdi-exercises/project2/issues/629/comments","events_url":"https://api.github.com/repos/ga-wdi-exercises/project2/issues/629/events","html_url":"https://github.com/ga-wdi-exercises/project2/issues/629","id":169926263,"number":629,"title":"Nested Resources: Update only updates all nested items instead of selected item","user":{"login":"pamelaolney","id":19878621,"avatar_url":"https://avatars.githubusercontent.com/u/19878621?v=3","gravatar_id":"","url":"https://api.github.com/users/pamelaolney","html_url":"https://github.com/pamelaolney","followers_url":"https://api.github.com/users/pamelaolney/followers","following_url":"https://api.github.com/users/pamelaolney/following{/other_user}","gists_url":"https://api.github.com/users/pamelaolney/gists{/gist_id}","starred_url":"https://api.github.com/users/pamelaolney/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pamelaolney/subscriptions","organizations_url":"https://api.github.com/users/pamelaolney/orgs","repos_url":"https://api.github.com/users/pamelaolney/repos","events_url":"https://api.github.com/users/pamelaolney/events{/privacy}","received_events_url":"https://api.github.com/users/pamelaolney/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-08-08T13:42:45Z","updated_at":"2016-08-08T14:03:43Z","closed_at":"2016-08-08T14:03:43Z","body":"Hi,\r\n\r\nMy project is the following.\r\n\r\nhttps://github.com/pamelaolney/uppercut/tree/master/uppercut\r\n\r\nI am having issues with updating my nested resource short_goal.  Whenever I press update when editing my short goal, it updates all of the nested short_goals under the resource long_goal.\r\n\r\nHere is my **controller for short_goals**\r\n\r\n```ruby\r\n def edit\r\n    @long_goal = LongGoal.find(params[:long_goal_id])\r\n    @short_goal = ShortGoal.find(params[:id])\r\n  end\r\n\r\n  def update\r\n    @long_goal = LongGoal.find(params[:id])\r\n    @long_goal.short_goals.update(short_goal_params)\r\n    redirect_to @long_goal\r\n  end\r\n\r\n  private\r\n\r\n  def short_goal_params\r\n    params.require(:short_goal).permit(:goal, :scheduled_date, :location, :long_goal_id)\r\n  end\r\n```\r\n\r\nThis is my **rake routes**\r\n\r\n```\r\nPrefix Verb   URI Pattern                                              Controller#Action\r\n               main_index GET    /main/index(.:format)                                    main#index\r\n                     root GET    /                                                        main#index\r\n    long_goal_short_goals GET    /long_goals/:long_goal_id/short_goals(.:format)          short_goals#index\r\n                          POST   /long_goals/:long_goal_id/short_goals(.:format)          short_goals#create\r\n new_long_goal_short_goal GET    /long_goals/:long_goal_id/short_goals/new(.:format)      short_goals#new\r\nedit_long_goal_short_goal GET    /long_goals/:long_goal_id/short_goals/:id/edit(.:format) short_goals#edit\r\n     long_goal_short_goal GET    /long_goals/:long_goal_id/short_goals/:id(.:format)      short_goals#show\r\n                          PATCH  /long_goals/:long_goal_id/short_goals/:id(.:format)      short_goals#update\r\n                          PUT    /long_goals/:long_goal_id/short_goals/:id(.:format)      short_goals#update\r\n                          DELETE /long_goals/:long_goal_id/short_goals/:id(.:format)      short_goals#destroy\r\n               long_goals GET    /long_goals(.:format)                                    long_goals#index\r\n                          POST   /long_goals(.:format)                                    long_goals#create\r\n            new_long_goal GET    /long_goals/new(.:format)                                long_goals#new\r\n           edit_long_goal GET    /long_goals/:id/edit(.:format)                           long_goals#edit\r\n                long_goal GET    /long_goals/:id(.:format)                                long_goals#show\r\n                          PATCH  /long_goals/:id(.:format)                                long_goals#update\r\n                          PUT    /long_goals/:id(.:format)                                long_goals#update\r\n                          DELETE /long_goals/:id(.:format)                                long_goals#destroy\r\n```\r\n\r\n\r\nAnd my **form**, but I am pretty sure this is right.\r\n\r\n```html\r\n<%= form_for [@long_goal, @short_goal] do |f| %>\r\n\r\n  <%= f.label :goal %>\r\n  <%= f.text_field :goal %>\r\n\r\n  <%= f.label :scheduled_date %>\r\n  <%= f.date_field :scheduled_date %>\r\n\r\n  <%= f.label :location %>\r\n  <%= f.text_field :location %>\r\n\r\n<%= f.submit %>\r\n<% end %>\r\n```\r\n\r\nGrateful for your help."}}
{"actor":{"display_login":"pamelaolney"}}