I’ve been trying to figure out how to write a form_for version of this form for my passwords_controller. I have resources :passwords in my routes.rb file. I looked at my login form and even though it doesn’t really access the model I still used form_for and it worked. I tried the same thing and I keep getting issues so I’m using the code below and that’s working but would really like to know what I’m doing wrong?
<%= form_tag passwords_path, :method => :post do %>
<div id="#emailFieldJoin">
<%= text_field_tag :email, params[:email], :placeholder => "Email" %>
</div>
<div class="actions"><%= submit_tag "Reset Password" %></div>
<% end %>
Figured it out by studying my sessions_controller and associated view file.
Basically:
The first argument is a symbol of your choice.
I used params[:password_reset][:email] to grab these params from my view in my passwords controller.
So the important thing is the first argument passed to the form_for helper.