user#create render = 'new' does not work generates no template errors
Note: I am running Rails 3.1.0
In Lesson #8: Sign up
In the tutorial at time index ~25:53 - I am following the instructions to render the new page when the create action is called.
the 'create' action for users_controller is a follows:
def create
@user = User.new
@title = "signup"
render = "new"开发者_开发百科
end
When trying to render - I still get the "Missing Template" error displayed in the tutorial even after following the screencast. It suggests that I still require a template -> views/users/create
Any ideas? is this related to Rails 3.1.0?
You have to use:
render :new
render
is a method. render :new
is basically the same as render(:new)
. When you do render = "new"
you just assign the string "new"
to a new local variable render
.
Replace:
render = "new"
With:
render "new"
It's a method requiring an argument.
精彩评论