gpt4 book ai didi

ruby-on-rails - ActiveRecord::Base 的未定义方法#sanitize

转载 作者:数据小太阳 更新时间:2023-10-29 06:59:19 26 4
gpt4 key购买 nike

我刚刚升级到 Rails 5.1.1 并收到此错误。

NoMethodError (undefined method `sanitize' for ActiveRecord::Base:Class):

栈回溯到这段代码

like_search_term = ActiveRecord::Base::sanitize("%#{escaped_search_term}%")

在新的 Rails 升级中是否删除或更改了此方法?

最佳答案

是的,的确,它看起来是removed .

Sanitize was never part of the public API of the framework. As we didn't need it in the framework anymore, we removed. The recommended ways to sanitize raw SQL for use in execute statements were the public API for that http://api.rubyonrails.org/classes/ActiveRecord/Sanitization/ClassMethods.html

关于ruby-on-rails - ActiveRecord::Base 的未定义方法#sanitize,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44575106/

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