Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support SQL sanitization in AR::QueryMethods#order #13008

Merged
merged 1 commit into from
Oct 29, 2015

Commits on Nov 22, 2013

  1. Support SQL sanitization in AR::QueryMethods#order

    Add support for sanitizing arrays in SQL ORDER clauses.
    
    This is useful when using MySQL `ORDER BY FIELD()` to return records in
    a predetermined way.
    
    ```ruby
      Tag.order(['field(id, ?', [1,3,2]].to_sql
      # => SELECT "tags".* FROM "tags"   ORDER BY field(id, 1,3,2)
    ```
    
    Prior to this, developers must be careful to sanitize `#order` arguments
    themselves.
    ktheory committed Nov 22, 2013
    Configuration menu
    Copy the full SHA
    b173733 View commit details
    Browse the repository at this point in the history