Reputation: 41929
The Devise wiki has instructions https://github.com/plataformatec/devise/wiki/How-To:-Display-a-custom-sign_in-form-anywhere-in-your-appfor creating a sign_in form anywhere on a site. I wanted to put the sign_up form on the home page.
The sign_in form they recommend begins like this
<%= form_for("user", :url => user_session_path) do |f| %>
Based on what that example and this output from rake routes
new_user_registration GET /users/sign_up(.:format) devise/registrations#new
I started the sign_up form like this on my site home page
<%= form_for("user", :url => new_user_registration_path) do |f| %>
When I revved up the server and tried to sign up a user, I got this error
No route matches [POST] "/users/sign_up"
Try running rake routes for more information on available routes.
The one thing I notice is that rake routes
shows a GET request for the new_user_registration, while my error message is showing a POST. Not sure if that's significant.
Routes.rb
root :to => "home#index"
devise_for :users
resources :users
Upvotes: 3
Views: 3109
Reputation: 41929
The problem was that this
new_user_registration_path
is the wrong path. That goes to the "new" action
It should have been
user_registration_path
which goes to the "create" action
Upvotes: 3