Cool Guy Yo
Cool Guy Yo

Reputation: 6110

No route matches [GET] "/user/1" following Michael Hartls rails tutorial

I am on listing 7.3, and am getting a no route error. I am very new to rails, so what other files can I provide to help debug by no route.

Here is my routes files

SampleApp::Application.routes.draw do
  resources :users

  root to: 'static_pages#home'

  match '/signup',  to: 'users#new'
  match '/signup', to: 'users#new'
  match '/help',    to: 'static_pages#help'
  match '/about',   to: 'static_pages#about'
  match '/contact', to: 'static_pages#contact'


end

Upvotes: 0

Views: 1186

Answers (2)

yvikt
yvikt

Reputation: 11

Got the same problem )

My mistake was resource :users in routes.rb

But correct is resources :users

In first case you get GET /users(.:format) users#show rake route output and can access your user throo url http://localhost:3000/users?id=1

In second case you get user GET /users/:id(.:format) users#show rake route output and can access your user throo url http://localhost:3000/users/1

Upvotes: 1

Logan Serman
Logan Serman

Reputation: 29860

You should use "/users/1", not "/user/1".

Upvotes: 3

Related Questions