ActionNotFound(无法找到UsersController的动作'show'):ruby on rails

问题描述 投票:0回答:2

每次我点击用户名时都会收到此错误(在此your_list.html.erb中找不到针对UsersController的操作'show')

这是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>

这是我的用户控制器

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

单击按钮时,此命令行的图像

enter image description here

jquery ruby-on-rails ruby ruby-on-rails-3 rubygems
2个回答
0
投票

正确的错字它应该show而不是shown

def show
  @user = User.find(params[:id])
  @items = @user.items
end

创建qazxsw poi模板到你的qazxsw poi文件夹,如qazxsw poi


0
投票

确保重新检查routes.rb以查找路由条目

show

和控制器重命名操作名称显示以显示和呈现相应的your_list.html.erb文件

users
© www.soinside.com 2019 - 2024. All rights reserved.