I am trying to do something simple: in my Rails view, I have a text input that I want to capture and append to the params. I found a similar question, but I want to know if I can do it inline without updating the controller.
First, in the view, I have a form input and a Rails link. These work independently right now for testing, but I can pass the username as a param on button click:
<form>
<input type="text" name="name">
</form>
<%= button_to 'Call Action', points_path(username: @current_user.last.username), method: :post %>
I want to remove the @current_user.last.username
and instead pass what the user has typed in the input as a param.
Is there a way to do this without a subaction, as outlined above, in the controller (either through a helper or using Javascript with my Rails link)?