From a9dabd6939f99148750854b09bbb0eeeaed21d51 Mon Sep 17 00:00:00 2001 From: Chetna Sharma Date: Mon, 25 Jul 2016 18:17:18 +0530 Subject: [PATCH] [ci skip] Add documentation for error using select with order --- guides/source/active_record_querying.md | 1 + 1 file changed, 1 insertion(+) diff --git a/guides/source/active_record_querying.md b/guides/source/active_record_querying.md index 90f200133bc46..8ffd0d033d2a1 100644 --- a/guides/source/active_record_querying.md +++ b/guides/source/active_record_querying.md @@ -601,6 +601,7 @@ If you want to call `order` multiple times, subsequent orders will be appended t Client.order("orders_count ASC").order("created_at DESC") # SELECT * FROM clients ORDER BY orders_count ASC, created_at DESC ``` +WARNING: If you are using **MySQL 5.7.5** and above, then on selecting fields from a result set using methods like `select`, `pluck` and `ids`; the `order` method will raise an `ActiveRecord::StatementInvalid` exception unless the field(s) used in `order` clause are included in the select list. See the next section for selecting fields from the result set. Selecting Specific Fields -------------------------