instance method
quote
Ruby on Rails 5.0.7.2
Signature
quote(value, column = nil)
Quotes the column value to help prevent SQL injection attacks.
Parameters
-
valuereq -
columnopt = nil
Source
# File activerecord/lib/active_record/connection_adapters/abstract/quoting.rb, line 9
def quote(value, column = nil)
# records are quoted as their primary key
return value.quoted_id if value.respond_to?(:quoted_id)
if column
ActiveSupport::Deprecation.warn(<<-MSG.squish)
Passing a column to `quote` has been deprecated. It is only used
for type casting, which should be handled elsewhere. See
https://github.com/rails/arel/commit/6160bfbda1d1781c3b08a33ec4955f170e95be11
for more information.
MSG
value = type_cast_from_column(column, value)
end
_quote(value)
end
Defined in activerecord/lib/active_record/connection_adapters/abstract/quoting.rb line 9
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::ConnectionAdapters::Quoting