Display link in Rails form error message

后端 未结 6 2035
执笔经年
执笔经年 2021-02-05 18:47

On our sign-up form, we validates_uniqueness_of :email

When the a user is attempting to use our sign up form and they specify an existing email address, I\'

6条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-05 19:04

    You can place a tag of your own like ~[new_password_url] in your error messages. Then at the point of rendering your error messages gsub ur tag with the actual. if you want to do it generically you can get the path out using regexp and then eval it to get the url then gsub it back in. make you use the raw method if you are putting html into your text.

提交回复
热议问题