1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

fixes in active record query for reorder

This commit is contained in:
peeyush 2014-05-21 23:40:19 +05:30
parent b042f21c93
commit 18c5f4ef9d

View file

@ -753,13 +753,13 @@ Post.find(10).comments.reorder('name')
The SQL that would be executed:
```sql
SELECT * FROM posts WHERE id = 10 ORDER BY name
SELECT * FROM comments WHERE post_id = 10 ORDER BY name
```
In case the `reorder` clause is not used, the SQL executed would be:
```sql
SELECT * FROM posts WHERE id = 10 ORDER BY posted_at DESC
SELECT * FROM comments WHERE post_id = 10 ORDER BY posted_at DESC
```
### `reverse_order`