Rails 5.2 にアップグレードしようとしたアプリケーションによっては以下のような警告の川が流れた際には、対象のクエリ文字列を Arel.sql()
で囲うなどで氾濫を塞き止める。
Arel.sql()
で囲うのはその文字列が、ソースコード上でハードコードされている文字列など SQL に渡すにあたりセキュアな文字列であることを示す意味合いなので、そのあたり外部パラメータを式展開して問題があったりしないか確認しつつもちいるとよい。
DEPRECATION WARNING: Dangerous query method (method whose arguments are used as raw SQL) called with non-attribute argument(s): "対象のSQL文字列". Non-attribute arguments will be disallowed in Rails 6.0. This method should not be called with user-provided values, such as request parameters or model attributes. Known-safe values can be passed by wrapping them in Arel.sql().
この警告については、2017年11月15日に発刊されているヤギヌマ新聞で取り上げられているので、参照先にて Arel.sql
でページ内検索すると詳しいです。