I am having trouble understanding as how do you trigger specific button event when using Ruby on Rails. For example I have a mini form inside a table as so (View side of MVC):
<%= form_tag do %>
<% if student.floor_pref == '1st' %>
<td><%= select_tag 'room', options_for_select(@first_floor.map { |value| [value,value]}, @selected_room) %></td>
<% end %>
<% if student.floor_pref == '2nd' %>
<td><%= select_tag 'room', options_for_select(@second_floor.map { |value| [value,value]}, @selected_room) %></td>
<% end %>
<% if student.floor_pref == '3rd' %>
<td><%= select_tag 'room', options_for_select(@third_floor.map { |value| [value,value]}, @selected_room) %></td>
<% end %>
<td><%= submit_tag 'Update' %></td>
<% end %>
How do I tell the controller that when the Update button is clicked inside the view to for example execute this code:
a = Student.find(3)
a.room_number = '2105'
a.save