how to escape a string before insert or update in Ruby

Posted by ywenbo on Stack Overflow See other posts from Stack Overflow or by ywenbo
Published on 2010-12-24T09:57:45Z Indexed on 2010/12/24 11:53 UTC
Read the original article Hit count: 231

Hi guy,

In ruby ActiveRecord doesn't provide dynamic binding for update and insert sqls, of course i can use raw sql, but that need maintain connection, so i want to know if there is simpler way to escape update or insert sql before executing like code below:

ActiveRecord::Base.connection.insert(sql)

i think i can write code by gsub, but i know if there has been a ready method to do it.

thank you very much, and Merry Christmas for you all.

© Stack Overflow or respective owner

Related posts about ruby

Related posts about activerecord