I see two options for solving your problem.
Using javascript, you can change the action of the form based on the selected radio button.
$("#radio").change(function() { var action = $(this).val() == "some_value" ? "login" : "sign_up"; $("#your-form").attr("action", "/" + action); });
Or you can process both methods in one action and process each of the options separately
#view <p> <%= radio_button_tag :option, "login" %> Orange </p> <p> <%= radio_button_tag :option, "sign_up" %> Peach </p> #controller if params[:option] == "login" #do login elsif params[:option] == "sign_up" #do sign up end
Hope this helps!
source share