2019-03-13から1日間の記事一覧

rails テーブルのカラム名のエスケープ

SQLの一部を書きたくて以下のようにしていたらsiderで「Possible SQL injection」と怒られた。SQLはエスケープしないとダメですね修正前 scope :my_scope, -> column { joins("left join xxx on xxx.id = yyy.xxx_id and yyy.#{column} = 1") }修正後 scope …