
























用户登录章节,
书上的代码会报错,Can’t mass-assign protected attributes: password_confirmation。
解决办法:
在rails3.2中,自动生成脚手架的话,app/models/user.rb中有这么一行
1 attr_accessible :name, :hashed_password,:salt
需在后面加上:password_confirmation和:password两项属性。即
attr_accessible :name, :password_confirmation,:password,:hashed_password,:salt
参考:http://www.cnblogs.com/suprise/
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。