I have a assessment model like Rails Survey Gem (runtimerevolution), there teacher create a MCQ assessment for student. Its Options are in type of radio button. there one option is correct.

when a student apply for a MCQ assessment, it get a question paper where Question has multiple options and student select one option through radio button.

So I just want to store that selected option\_id regarding question\_id in my new model attempt.

Here is apply page of MCQ for student.

```
<div class="stream-cont">
    <%= form_tag(action: "apply") do %>
        <% @mcq.questions.each_with_index do |q, i| %>
            <div class="feed-cont-title all-header">
                <p>
                    <%="Question-#{i+1}: "+ q.question %>
                </p>
                <p>
                    <strong>Answer : </strong>
                    <%=
                      collection_radio_buttons("questions[#{q.id}]", :option_id, q.options, :id, :option) do |b|
                        b.label(style: "display:block") { b.radio_button + b.text }
                      end
                  %>
                </p>
            </div>
        <% end %>
    <% end %>
    <%= submit_tag "Submit Answer", :class => "typeD button" %>
</div>

```

here is Mcq controller

```
    def apply

            @club = current_user.clubs
            if current_user.user_type == User::User_types[:student]
                @mcq = Mcq.find(params[:id])
            end

            @attempt = current_user.attempts.new

            @mcq = Mcq.find(params[:id])
            @attempt = current_user.attempts.new(attempt_params)
            @attempt.save
            redirect_to attempt_id(@attempt.id), notice: "Thank you"
        end

        Private
        def attempt_params
          params.require(:attempt).permit(:user_id, :mcq_id,    :question_id, :option_id)
       end
    end

```

it is not complete and I know it is incorrect. I just want to know how I get selected Option\_id regarding question\_id and save this value in attempt model's option\_id column.

I have know idea how to manage it and what should use in view and controller.