<% answer.question.answer_options.each_with_index do |answer_option, idx| %> <% choice = answer.selected_choices.find { |choice| choice.answer_option_id == answer_option.id } %>
<%= label_tag do %> <%= check_box_tag "questionnaire[responses][#{answer_idx}][choices][#{idx}][body]", translated_attribute(answer_option.body), choice.present?, disabled: disabled %> <%= translated_attribute(answer_option.body) %> <%= hidden_field_tag "questionnaire[responses][#{answer_idx}][choices][#{idx}][answer_option_id]", answer_option.id %> <% end %> <% if answer_option.free_text %> <%= text_field_tag "questionnaire[responses][#{answer_idx}][choices][#{idx}][custom_body]", choice.try(:custom_body), disabled: true, maxlength: maxlength %> <% end %>
<% end %>