Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. <%= form_for [@child, @answer] do |f| %>
  2. <% @parent.questions.each_with_index do |question, i| %>
  3. <p>(Q<%= i + 1 %>) <%= question.text %>
  4. <%= f.hidden_field :question_id, :value => question.id, :index => "index#{i}" %>
  5. <label><%= f.radio_button :answer, 0, :index => "index#{i}" %>A</label>
  6. <label><%= f.radio_button :answer, 1, :index => "index#{i}" %>B</label>
  7. <label><%= f.radio_button :answer, 2, :index => "index#{i}" %>C</label>
  8. <label><%= f.radio_button :answer, 3, :index => "index#{i}" %>D</label>
  9. </p>
  10. <% end %>
  11. <%= f.submit "SEND" %>
  12. <% end %>
  13.  
  14. Parameters: {"utf8"=>"✓", "authenticity_token"=>"9y96VdvAbs...", "answer"=>{"index0"=>{"question_id"=>"135", "answer"=>"3"}, "index1"=>{"question_id"=>"136", "answer"=>"1"}, "index2"=>{"question_id"=>"137", "answer"=>"1"}}, "commit"=>"SEND", "child_id"=>"480"}
  15. Unpermitted parameters: index0, index1, index2
  16. (0.2ms) BEGIN
  17. SQL (0.2ms) INSERT INTO `answers` (`child_id`, `created_at`, `updated_at`) VALUES (480, '2017-07-20 19:36:31', '2017-07-20 19:36:31')
  18. (1.0ms) COMMIT
  19. Unpermitted parameters: index0, index1, index2
  20. (0.1ms) BEGIN
  21. SQL (0.2ms) INSERT INTO `answers` (`child_id`, `created_at`, `updated_at`) VALUES (480, '2017-07-20 19:36:31', '2017-07-20 19:36:31')
  22. (0.3ms) COMMIT
  23. Unpermitted parameters: index0, index1, index2
  24. (0.1ms) BEGIN
  25. SQL (0.3ms) INSERT INTO `answers` (`child_id`, `created_at`, `updated_at`) VALUES (480, '2017-07-20 19:36:31', '2017-07-20 19:36:31')
  26. (0.3ms) COMMIT
  27. Child Load (0.2ms) SELECT `children`.* FROM `children` WHERE `children`.`id` = 480 LIMIT 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement