gpt4 book ai didi

ruby-on-rails - Ruby on Rails : Is there a way to make blank form inputs submit nil?

转载 作者:行者123 更新时间:2023-12-03 16:03:07 25 4
gpt4 key购买 nike

这个问题在这里已经有了答案:




9年前关闭。




Possible Duplicate:
Make blank params[] nil



有没有办法让空白表单输入提交为零?现在,我正在经历并在 before_save 中手动将所有 ""转换为 nil。

这看起来真的不是很 DRY,我觉得我一定错过了一些东西。

最佳答案

查看 attribute_normalizer插入。

关于ruby-on-rails - Ruby on Rails : Is there a way to make blank form inputs submit nil?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3113877/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com