I just upgraded to Rails 5.1.1 and am receiving this error.
NoMethodError (undefined method `sanitize' for ActiveRecord::Base:Class):
The stack traces back to this code
like_search_term = ActiveRecord::Base::sanitize("%#{escaped_search_term}%")
Has this method been removed or changed in the new Rails upgrade?
Yes, indeed, it appears to be 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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With