I created a new page on an existing controller.
I added 2 action methods on the controller: prompt_user and process_feedback.
So I get to the page via
redirect_to :controller => :users, :action => :prompt_user
And the form_for code looks like
<% form_for :user, @user do |f| %>
Which generates the following html
<form action="users/prompt_user" method="post">
Notice the action is prompt_user, where as I want to set it to process_feedback. I thought I could change the action with a button
<%= submit_tag "Process feedback" %>
But that didn't work.
So my question is how can I change the action to process_feedback?
Also, as you can probably tell, I'm very new to rails, so if I'm doing something especially obtuse, I'd love to find out what it is.
This is from memory, but I think you can do something like this:
form_for :user, @user, :url => { :action => :prompt_user } do |f|
Alternatively the same can be reached using form_tag
with the syntax:
See my answer on this question: here https://stackoverflow.com/a/37145293/1248725
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With