「Authentication from scratch」レールキャストに従っていますが、機能しません。
コントローラ:
class UsersController < ApplicationController
def new
@user = User.new
end
def create
@user = User.new(params[:user])
if @user.save
redirect_to products_path, notice: 'User created successfully'
else
render 'new'
end
end
end
モデル:
class User < ActiveRecord::Base
has_secure_password
attr_accessible :email, :password, :password_confirmation
validates_uniqueness_of :email
end
users#新しいフォーム:
<h1>Sign up form</h1>
<%= form_for @user do |f| %>
<%= f.label :email %>
<%= f.text_field :email %>
<%= f.label :password %>
<%= f.password_field :password %>
<%= f.label :password_confirmation %>
<%= f.password_field :password_confirmation %>
<%= f.submit %>
<% end %>
新しいユーザー フォームに移動しようとすると、NoMethodError がスローされます - 未定義のメソッド 'email' が 'f.text_field :email' を含む行を参照しています。
ここで何が欠けていますか?
助けてくれてありがとう。