Method: String#escape_for_sql
- Defined in:
- lib/libis/tools/extend/string.rb
#escape_for_sql ⇒ Object
Escape single quotes for usage in SQL statements
48 49 50 |
# File 'lib/libis/tools/extend/string.rb', line 48 def escape_for_sql self.gsub(/'/) { |s| ($` == '' || $' == '' ? '' : '\'') + s[0].to_s } end |