-3
所以我有这个数组动态创建:阵列迭代
array = [ "Name can't be blank", "Email can't be blank",
"Email is invalid", "Password can't be blank",
"Password is too short (minimum is 6 characters)",
"Password confirmation can't be blank" ]
什么,我想通过这个数组迭代,如果有值:
"Password can't be blank"
验证是否存在价值:
"Password confirmation can't be blank"
并摆脱它。
所以返回的数组将是:
array = [ "Name can't be blank", "Email can't be blank",
"Email is invalid", "Password can't be blank",
"Password is too short (minimum is 6 characters)"]
非常感谢!
为什么要麻烦?如果密码为空白,我宁愿删除“太短”警告。 –
你刚刚写到:'array.delete(“密码确认不能为空”)如果array.include?(“密码不能为空”)' – user2422869
“询问代码的问题必须证明对问题得到解决包括尝试解决方案,为什么他们不工作,以及预期的结果。另请参见:[堆栈溢出问题清单](http://meta.stackexchange.com/questions/156810/stack-overflow-question-清单)” –