Rails, how to sanitize SQL in find_by_sql

后端 未结 6 1285
孤城傲影
孤城傲影 2020-12-06 00:55

Is there a way to sanitize sql in rails method find_by_sql?

I\'ve tried this solution: Ruby on Rails: How to sanitize a string for SQL when not using fi

6条回答
  •  猫巷女王i
    2020-12-06 01:30

    User.find_by_sql(["SELECT * FROM users WHERE (name = ?)", params])
    

    Source: http://blog.endpoint.com/2012/10/dont-sleep-on-rails-3-sql-injection.html

提交回复
热议问题