0
votes

Routing Error

No route matches {:action=>"edit", :controller=>"statuses", :id=>nil}

When http://0.0.0.0:3000/users/2

Dont understand why it says :controller=>"statuses" when my route file says:

Treebook::Application.routes.draw do
get "users/show"
resources :credits
resources :merchants
devise_for :users
resources :statuses
root to: 'statuses#index'
get 'users/:id', to: 'users#show'

Rake Route

                root        /                              statuses#index
             credits GET    /credits(.:format)             credits#index
                     POST   /credits(.:format)             credits#create
          new_credit GET    /credits/new(.:format)         credits#new
         edit_credit GET    /credits/:id/edit(.:format)    credits#edit
              credit GET    /credits/:id(.:format)         credits#show
                     PUT    /credits/:id(.:format)         credits#update
                     DELETE /credits/:id(.:format)         credits#destroy
           merchants GET    /merchants(.:format)           merchants#index
                     POST   /merchants(.:format)           merchants#create
        new_merchant GET    /merchants/new(.:format)       merchants#new
       edit_merchant GET    /merchants/:id/edit(.:format)  merchants#edit
            merchant GET    /merchants/:id(.:format)       merchants#show
                     PUT    /merchants/:id(.:format)       merchants#update
                     DELETE /merchants/:id(.:format)       merchants#destroy
            statuses GET    /statuses(.:format)            statuses#index
                     POST   /statuses(.:format)            statuses#create
          new_status GET    /statuses/new(.:format)        statuses#new
         edit_status GET    /statuses/:id/edit(.:format)   statuses#edit
              status GET    /statuses/:id(.:format)        statuses#show
                     PUT    /statuses/:id(.:format)        statuses#update
                     DELETE /statuses/:id(.:format)        statuses#destroy
    new_user_session GET    /users/sign_in(.:format)       devise/sessions#new
        user_session POST   /users/sign_in(.:format)       devise/sessions#create
destroy_user_session DELETE /users/sign_out(.:format)      devise/sessions#destroy
       user_password POST   /users/password(.:format)      devise/passwords#create
   new_user_password GET    /users/password/new(.:format)  devise/passwords#new
  edit_user_password GET    /users/password/edit(.:format) devise/passwords#edit
                     PUT    /users/password(.:format)      devise/passwords#update

cancel_user_registration GET /users/cancel(.:format) devise/registrations#cancel user_registration POST /users(.:format) devise/registrations#create new_user_registration GET /users/sign_up(.:format) devise/registrations#new edit_user_registration GET /users/edit(.:format) devise/registrations#edit PUT /users(.:format) devise/registrations#update DELETE /users(.:format) devise/registrations#destroy user GET /users/:id(.:format) users#show

2
paste your whole routes file and the output of rake routes. That does not look correct what you have there.rainkinz
Also do this on console: rake routeskhelll
I would try getting rid of get "users/show" by the way. That doesn't look right to me.rainkinz
Just added rake routes to original question.Lut

2 Answers

1
votes

get "users/show" - that will probably be causing your problem

Here's a better routes file for you:

root to: "statuses#index"
resources :credits, :merchants, :statuses

devise_for :users
resources :users, only: [:show]
0
votes

Aggggg The problem was on some footer links that I copy pasted. I just deleted both links since I dont need them. Incredible how can your attention gets stuck in a point far away from the root problem.