我正在做Michael Hartl的Rails教程的第7章,并且在第7.2节中我想创建注册表单。这是我的users_controller.rb代码:无法为UsersController找到动作'news'
class UsersController < ApplicationController
def show
@user = User.find(params[:id])
end
def new
@user = User.new
end
end
,这里是我的show.html.erb
<% provide(:title, @user.name) %>
<div class="row">
<aside class="col-md-4">
<section class="user_info">
<h1>
<%= gravatar_for @user %>
<%= @user.name %>
</h1>
</section>
</aside>
</div>
当你的方法被称为'new'时,你指的是'news'方法。 – GhostGambler
@GhostGambler我是Ruby on Rails的新手,但我只是michel hartle在他的书中说过! https://www.railstutorial.org/book/sign_up部分7.2 – Narges