Hello Im creating an app that has user profiles.
When i click on a user such as http://localhost:3000/users/53 i receive this error.
I tried looking around but can't really find an answer. Anyone have any ideas?
ActionController::RoutingError (No route matches [GET] "/users/..."):
actionpack (4.2.0) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
web-console (2.1.2) lib/web_console/middleware.rb:37:in `call'
actionpack (4.2.0) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.2.0) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.2.0) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.2.0) lib/active_support/tagged_logging.rb:68:in `block in tagged'
activesupport (4.2.0) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (4.2.0) lib/active_support/tagged_logging.rb:68:in `tagged'
railties (4.2.0) lib/rails/rack/logger.rb:20:in `call'
actionpack (4.2.0) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.6.1) lib/rack/methodoverride.rb:22:in `call'
rack (1.6.1) lib/rack/runtime.rb:18:in `call'
Here is some of my user_controller.rb pay attention to def show
class UsersController < ApplicationController
before_action :logged_in_user, only: [:index, :edit, :update, :destroy]
before_action :correct_user, only: [:edit, :update]
before_action :admin_user, only: :destroy
def index
@users = User.paginate(page: params[:page])
end
def new
@user = User.new
end
def show
@user = User.find(params[:id])
@item = @user.items.paginate(page: params[:page])
end
Here is my routes.rb
Rails.application.routes.draw do
get 'password_resets/new'
get 'password_resets/edit'
get 'sessions/new'
resources :users
root 'items#index'
get 'signup' => 'users#new'
get 'show' => 'users#show'
get 'login' => 'sessions#new'
post 'login' => 'sessions#create'
delete 'logout' => 'sessions#destroy'
resources :account_activations, only: [:edit]
resources :password_resets, only: [:new, :create, :edit, :update]
resources :items
get 'items' => 'items#index'
get 'items_new' => 'items#new'
Aucun commentaire:
Enregistrer un commentaire