Home Ask Login Register

Developers Planet

Your answer is one click away!

Mirek February 2016

Routing Error: No route matches [GET] "/users/sign_up"

I am new to stackoverflow and recently I'm learning Ruby on Rails. I can't solve the problem od localhost: No route matches [GET] "/ users / sign_up" (Devise gem).

Here is my code:


Rails.application.routes.draw do

  resources :posts do
    resources :comments

  root 'posts#index'

  get '/about' => 'pages#about'


In config/development.rb I added:

config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }

Rake routes shows:

post_comments_path  GET /posts/:post_id/comments(.:format)  comments#index
                    POST    /posts/:post_id/comments(.:format)  comments#create
new_post_comment_path   GET /posts/:post_id/comments/new(.:format)  comments#new
edit_post_comment_path  GET /posts/:post_id/comments/:id/edit(.:format) comments#edit
post_comment_path   GET /posts/:post_id/comments/:id(.:format)  comments#show
                    PATCH   /posts/:post_id/comments/:id(.:format)  comments#update
                    PUT /posts/:post_id/comments/:id(.:format)  comments#update
                    DELETE  /posts/:post_id/comments/:id(.:format)  comments#destroy
posts_path  GET /posts(.:format)    posts#index
                    POST    /posts(.:format)    posts#create
new_post_path   GET /posts/new(.:format)    posts#new
edit_post_path  GET /posts/:id/edit(.:format)   posts#edit
post_path   GET /posts/:id(.:format)    posts#show
                    PATCH   /posts/:id(.:format)    posts#update
                    PUT /posts/:id(.:format)    posts#update
                    DELETE  /posts/:id(.:format)    posts#destroy
root_path   GET /   posts#index
about_path  GET /about(.:format)    pages#about

I restarted the server but nothing helps. I haven't found a good hint in similar topics.



Ilya February 2016

You must define users/sign_up route in your routes.rb

Mirek February 2016

OK, I found the solution. In gemfile should be:

gem 'devise': git => 'https://github.com/plataformatec/devise.git'

(v. 4.0.0) instead

gem 'devise' '~> 3.3.0'

Devise 3.3.0 is not compatible with Rails 4.2.


ImranNaqvi February 2016

If you're using default Devise Routes as below

`/`             `POST`      `Email registration`
`/`             `DELETE`    `Account deletion`. 
`/`             `PUT`       `Account updates`
`/sign_in`      `POST`      `Email authentication`.
`/sign_out`     `DELETE`    

And devise_for :users then you don't need to do user/auth , instead just use / or /auth (base on :at option which is defined in devise) for routes All the routes are well defined in the documents

Post Status

Asked in February 2016
Viewed 1,909 times
Voted 14
Answered 3 times


Leave an answer

Quote of the day: live life