method

sanitize_sql_for_order

Importance_1
Ruby on Rails latest stable (v7.1.3.2) - 0 notes - Class: ClassMethods
sanitize_sql_for_order(condition) public

Accepts an array, or string of SQL conditions and sanitizes them into a valid SQL fragment for an ORDER clause.

sanitize_sql_for_order([Arel.sql("field(id, ?)"), [1,3,2]])
# => "field(id, 1,3,2)"

sanitize_sql_for_order("id ASC")
# => "id ASC"
Show source
Register or log in to add new notes.