Install multiple buttons and get the value of the pressed button as shown below
View Jump to the purpose action of the select controller
button.html.erb
<%= form_tag({ :controller => 'select', :action => 'purpose' }) do %>
<%= submit_tag "A" %><br>
<%= submit_tag "B" %><br>
<%= submit_tag "C" %><br>
<%= submit_tag "D" %><br>
<% end %>
Controller
The value of the button is entered in params [: commit]
select_controller.rb
class SelectController < ApplicationController
def purpose
#A,B,C,Enter the value of the button such as D
@name=params[:commit]
end
Recommended Posts