Method: ActiveRecord::ConnectionAdapters::PostgreSQLAdapter#quote_string
- Defined in:
- lib/active_record/connection_adapters/postgresql_adapter.rb
#quote_string(s) ⇒ Object
Quotes strings for use in SQL input in the postgres driver for better performance.
378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 |
# File 'lib/active_record/connection_adapters/postgresql_adapter.rb', line 378 def quote_string(s) #:nodoc: if PGconn.respond_to?(:escape) self.class.instance_eval do define_method(:quote_string) do |s| PGconn.escape(s) end end else # There are some incorrectly compiled postgres drivers out there # that don't define PGconn.escape. self.class.instance_eval do remove_method(:quote_string) end end quote_string(s) end |