瞎扯淡 吐槽一下 Rails 5.2 的 DEPRECATION WARNING: Dangerous query method

hw676018683 · April 12, 2018 · Last by Jession replied at October 24, 2018 · 1363 hits

相关代码:https://github.com/rails/rails/blob/v5.2.0/activerecord/lib/active_record/attribute_methods.rb#L193

根据写这个的人说的,好像就是为了告诉你正在手写一个 sql。

感觉难受一下开发者之外,作用并不怎么大。

ps:这样一个牛 (dan) 逼 (teng) 的限制好像没走 PR?

拒绝不经意的手打 SQL。如果你强行要手打 SQL,包一层就行。

Reply to msg7086

手打 SQL 遇到此问题,请问具体怎么操作呢?😥

Reply to Jession

order: Arel.sql("topics.id")

上面链接里写的。我没试过。

Reply to msg7086

感谢,已解决😁

You need to Sign in before reply, if you don't have an account, please Sign up first.