Rails form validation conditional bypass

后端 未结 4 594
眼角桃花
眼角桃花 2020-12-08 11:34

I have a rails model that validates uniqueness of 2 form values. If these 2 values aren\'t unique the validation errors are shows and the \"submit\" button is changed to \"

4条回答
  •  借酒劲吻你
    2020-12-08 12:12

    Not positive about this, but you could try to add an attr_accessor to your model to hold whether or not the form has been submited once before.

    just add

    attr_accessor :submitted

    to your model and check for it in your validations.

提交回复
热议问题