I am still learning Ruby on Rails and was trying to do call a custom method check_bike_in in that controller and passing it the values from the check box and text area when I click the button.
I am using the helper_method to call check_bike_in, but I am not sure how to call it when the button is clicked or how to pass the variables to the controller.
Any help would be greatly appreciated.
<table class="checked_out">
<thead>
<tr>
<th>User</th>
<th>Bike</th>
<th>Checkout time</th>
</tr>
</thead>
<tbody>
<% @checkouts.each do |checkout| %>
<tr>
<td class="user"><%= checkout.user_id %></td>
<td class="bike_number"><%= checkout.bike_id %></td>
<td><button onclick="$('#<%= checkout.id %>').toggle()">Check Bike In</button></td>
</tr>
<tr style="display: none" id = "<%= checkout.id %>">
<td class="needs_reapir_checkbox"><input type="checkbox"> Needs Repair</td>
<td class="repair_textbox"><textarea rows="1" cols="50"></textarea></td>
<td><button onclick="">Check In</button></td>
</tr>
<% end %>
</tbody>
</table>