也是自己写个 JS 判断,还是 RAILS 有现成的功能?
使用 validates :password, :confirmation => true
validates :password, presence: { on: :create}, confirmation: { allow_blank: true }, length:{maximum:20,minimum:6}
谢谢大家帮助。回头试下