我想使用bcryting,所以我写道:
User.rb型号:
class User < ActiveRecord::Base
has_sesure_password
end
用户控制器:
def new
@user = User.new
end
def create
@user = User.new(user_params)
if @user.save?
redirect_to "http://178.62.102.154:3000/"
end
end
def user_params
params.require(:user).permit(:username, :password_digest)
end
在加载它打印的页面时:
undefined local variable or method has_sesure_password' for User(id: integer, username: string, password_digest: string):Class
有什么问题?
答案 0 :(得分:1)
我认为,它应该是 has_secure_password ,而不是has_ sesure _password