Hi, I am trying to build a ruby on rails application but I am unable to resolve this issue:
ERROR["test_should_redirect_update_when_not_logged_in", UsersControllerTest, 3.086077447998832]
test_should_redirect_update_when_not_logged_in#UsersControllerTest (3.09s)
ActionController::UrlGenerationError: ActionController::UrlGenerationError: No route matches {:action=>"show", :controller=>"user
s", :id=>nil} missing required keys: [:id]
test/controllers/users_controller_test.rb:17:in `block in <class:UsersControllerTest>'
Here is my routes:
root 'main_pages#home'
get '/about', to: 'main_pages#about'
get '/help', to: 'main_pages#help'
get '/signup', to: 'users#new'
post '/signup', to: 'users#create'
get '/login', to: 'sessions#new'
post '/login', to: 'sessions#create'
delete '/logout', to: 'sessions#destroy'
resources :users
And here is my rake/rails routes:
Prefix Verb URI Pattern Controller#Action
root GET / main_pages#home
about GET /about(.:format) main_pages#about
help GET /help(.:format) main_pages#help
signup GET /signup(.:format) users#new
POST /signup(.:format) users#create
login GET /login(.:format) sessions#new
POST /login(.:format) sessions#create
logout DELETE /logout(.:format) sessions#destroy
users GET /users(.:format) users#index
POST /users(.:format) users#create
new_user GET /users/new(.:format) users#new
edit_user GET /users/:id/edit(.:format) users#edit
user GET /users/:id(.:format) users#show
PATCH /users/:id(.:format) users#update
PUT /users/:id(.:format) users#update
DELETE /users/:id(.:format) users#destroy
I am unable to find the cause of this issue, I have been trying to fix it for the past 3 days without any success. Please help me...
What I have tried:
I have tried redoing the routes, I have checked every location of "users"