mercredi 28 février 2018

onclick on link_to user_path i get UsersController#show is missing a template ruby on rails

I'm getting error "UsersController#show is missing a template" once i click on span in your_list.html.erb I know the error it has to be cause i misplaced my show.html.erb file

borroup/app/views/reservations/your_list.html.erb

          <span class="pull-right text-center">
            <%= image_tag avatar_url(list.item.user), class: "img-circle avatar-medium" %></br>
            <%= link_to user_path(list.item.user) do %>
                <%= list.item.user.fullname %>
            <% end %>
          </span>

This is my user controller borroup/app/controllers/users_controller.rb

 class UsersController < ApplicationController
      def show
      @user = User.find(params[:id])
     end
  end

I do have show.html.erb in this path borroup/app/views/users/show.html.rb

and lastly in my routes.rb

Rails.application.routes.draw do
 root 'pages#home'
  devise_for :users,
          path: '',
          path_names:{sign_in: 'login', sign_out: 'logout', edit: 
          'profile', sign_up: 'registration'},
          controllers: {omniauth_callbacks: 'omniauth_callbacks' , 
          registrations: 'registrations'}
          # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
resources :users, only: [:show]
resources :items, except: [:edit] do
member do
  get 'listing'
  get 'pricing'
  get 'description'
  get 'photo_upload'
  get 'location'
  get 'preload'
  get 'preview'
end
   resources :photos, only: [:create, :destroy]
   resources :reservations, only: [:create]
   end
   get '/your_list' => 'reservations#your_list'
 end

Aucun commentaire:

Enregistrer un commentaire