我有以下型号:
class Client < ActiveRecord::Base
attr_accessible :email, :mobile, :notifications_option, :password, :password_confirmation, :promotion_code
validates_format_of :password, :with => /^(?=.*[^a-zA-Z])(?=.*[0-9])\S{8,}$/, :message => "Your password must be at least 8 characters long containing at least 1 number"
validates_confirmation_of :password
end
在我的控制器中我有:
def create
@client = current_client
if @client.update_attributes(params[:client])
#do this and that
else
render :new
end
end
我已经提出了@ client.inspect并知道我的密码和密码确认是相同的值。但我一直在
"doesn't match confirmation"
我已经尝试了所有但没有运气,我正在使用带有formtastic的rails 3.1.18。