{"action":"opened","issue":{"url":"https://api.github.com/repos/PENGZhaoqing/CourseSelect/issues/68","repository_url":"https://api.github.com/repos/PENGZhaoqing/CourseSelect","labels_url":"https://api.github.com/repos/PENGZhaoqing/CourseSelect/issues/68/labels{/name}","comments_url":"https://api.github.com/repos/PENGZhaoqing/CourseSelect/issues/68/comments","events_url":"https://api.github.com/repos/PENGZhaoqing/CourseSelect/issues/68/events","html_url":"https://github.com/PENGZhaoqing/CourseSelect/issues/68","id":198269161,"number":68,"title":"关于删除选课的参数问题","user":{"login":"ZhouHonghao","id":22397627,"avatar_url":"https://avatars.githubusercontent.com/u/22397627?v=3","gravatar_id":"","url":"https://api.github.com/users/ZhouHonghao","html_url":"https://github.com/ZhouHonghao","followers_url":"https://api.github.com/users/ZhouHonghao/followers","following_url":"https://api.github.com/users/ZhouHonghao/following{/other_user}","gists_url":"https://api.github.com/users/ZhouHonghao/gists{/gist_id}","starred_url":"https://api.github.com/users/ZhouHonghao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ZhouHonghao/subscriptions","organizations_url":"https://api.github.com/users/ZhouHonghao/orgs","repos_url":"https://api.github.com/users/ZhouHonghao/repos","events_url":"https://api.github.com/users/ZhouHonghao/events{/privacy}","received_events_url":"https://api.github.com/users/ZhouHonghao/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-01-01T14:33:19Z","updated_at":"2017-01-01T14:33:19Z","closed_at":null,"body":"助教您好。我有两个问题：\r\n第一个问题：\r\n在原版的选课系统中，关于学生退课的cotroller是这样的：\r\n  def quit\r\n    @course=Course.find_by_id(params[:id])\r\n    current_user.courses.delete(@course)\r\n    flash={:success => \"成功退选课程: #{@course.name}\"}\r\n    redirect_to courses_path, flash: flash\r\n  end\r\n而在view中是这样的：\r\n<% elsif student_logged_in? %>\r\n     <td><%= link_to \"删除\", quit_course_path(course), class: 'btn-sm btn-danger' %></td>\r\n <% end %>\r\n\r\n请问quit_course_path(course)为什么有参数course，在定义quit的时候参数是空的？\r\n\r\n第二个问题：\r\n我想做一个批量退课功能，即做一个多选框，选中多项后，点击退课按钮，一次退选多门课。但我不知道controller和view之间的参数应该如何传递？\r\n\r\nview:\r\n<% @course.each do |course| %>\r\n...<%= check_box_tag \"course_ids[]\", course.id %>...\r\n<% end %>\r\n...\r\n<%= link_to \"删除\", destroy_multiple_courses_path, class: 'btn-sm btn-danger' %>\r\n\r\ncontroller:\r\ndef destroy_multiple\r\n  respond_to do |format| if not params[:course_id] .nil?\r\n    begin\r\n      Course.transaction do\r\n         params[:course_id].each do |did|\r\n          if did != \"\"\r\n            @course = courses.find(did)\r\n            @course.destroy\r\n          end\r\n    end\r\n  end\r\n  flash[:notice] = \"删除数据成功！\"\r\n  rescue \r\n    flash[:notice] = \"删除数据失败！\" \r\n    end\r\n  else\r\n    flash[:notice] = '请选择要删除的课程！'\r\n  end\r\n  format.html { redirect_to(courses_url) }\r\n  format.xml  { head :ok }\r\n  end\r\nend"}}
{"actor":{"display_login":"ZhouHonghao"}}