user15217186
user15217186

Reputation:

How can I use a helper path inside of a form_for tag?

I have two view files that can log someone in. One is a new.html.erb file inside of users, and this makes an entirely new user and logs them in. On the login page, I have a form that begins with <%= form_for @user ... %> but when that's submitted it will have a route request of "POST /users". I want it to either "POST /signin" or at least I want to fit signin_path inside the form, but I don't know where or how

Upvotes: 0

Views: 236

Answers (1)

Carlo Osores
Carlo Osores

Reputation: 1

You can send a url parameter and a method parameter, with the signin_path and the method Post in your form_for.

<%= form_for @user, url: signin_path, method: :post do |f| %>

Upvotes: 0

Related Questions