Rails 插件用于跟踪验证错误
即使我们添加了最具解释性的错误消息并利用一些好的做法 为此,用户根本不会阅读错误消息。我们最常见的支持之一是用户未阅读的验证已涵盖的错误。
我们的软件有一个控制面板,支持人员可以快速访问他们可能需要的任何有用信息,以提供快速、优质的支持。
我想向此控制面板添加每个用户最近验证错误的列表,以便我们可以快速确定用户面临的问题是否只是验证问题。
是否有任何插件允许我在应用程序中的任何模型中编写对任何验证错误的回调?
我很想能够写出这样的东西
def on_any_validation_error(model, params)
#my logic to add to some log control database backed or not
end
Even if we add the most explaning error messages and make use of some good practices to do so, users simply don´t read error messages. One of the most recurring support that we have are errors already covered by validations not read by our users.
Our software has a control panel for the support people to have quick access to any usefull information they might need to provide a quick and quality support.
I want to add to this control panel a list of last validation errors per user so we can rapidly identify if the problem users are facing are just validation problems.
Are there any plugins that allow me to write a callback to any validation error in any model in my app?
I´d love to be able to write something like this
def on_any_validation_error(model, params)
#my logic to add to some log control database backed or not
end
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不知道是否存在这样的插件,但我刚刚玩了一下 after_validation 回调,您可以编写一个如下所示的初始化程序:
然后您必须在 log 方法中实现您的逻辑。
I don't know if a plugin like that exists but I've just played a bit with the after_validation callback, you could write an initializer with something like the following:
Then you have to implement your logic in the log method.