rails active model password_confirmation无法正常工作

时间:2013-08-22 14:59:37

标签: ruby-on-rails activerecord formtastic password-confirmation

我有以下型号:

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。

0 个答案:

没有答案