作者:訫嬘風飛_487_519 | 来源:互联网 | 2023-09-18 12:42
I have a form that allows the user to send a message to an email, and I want to add validation to it. I do not have a model for this, only a controller. How should I do this in Rails?
我有一个允许用户向电子邮件发送消息的表单,我想为其添加验证。我没有这个模型,只有一个控制器。我应该如何在Rails中执行此操作?
I was considering doing the validation in the controller, and displaying the errors to the user using the flash object. Is there a better way of doing this?
我正在考虑在控制器中进行验证,并使用flash对象向用户显示错误。有更好的方法吗?
2 个解决方案