diff options
Diffstat (limited to 'guides/source')
-rw-r--r-- | guides/source/5_2_release_notes.md | 4 | ||||
-rw-r--r-- | guides/source/active_record_querying.md | 26 |
2 files changed, 30 insertions, 0 deletions
diff --git a/guides/source/5_2_release_notes.md b/guides/source/5_2_release_notes.md index c5b914fffc..29b355119c 100644 --- a/guides/source/5_2_release_notes.md +++ b/guides/source/5_2_release_notes.md @@ -615,6 +615,10 @@ Please refer to the [Changelog][active-record] for detailed changes. the parent class was getting deleted when the child was not. ([Commit](https://github.com/rails/rails/commit/b0fc04aa3af338d5a90608bf37248668d59fc881)) +* Idle database connections (previously just orphaned connections) are now + periodically reaped by the connection pool reaper. + ([Commit](https://github.com/rails/rails/pull/31221/commits/9027fafff6da932e6e64ddb828665f4b01fc8902)) + Active Model ------------ diff --git a/guides/source/active_record_querying.md b/guides/source/active_record_querying.md index cb738f0657..270696d38d 100644 --- a/guides/source/active_record_querying.md +++ b/guides/source/active_record_querying.md @@ -807,6 +807,32 @@ SELECT * FROM articles WHERE id > 10 ORDER BY id DESC LIMIT 20 ``` +### `reselect` + +The `reselect` method overrides an existing select statement. For example: + +```ruby +Post.select(:title, :body).reselect(:created_at) +``` + +The SQL that would be executed: + +```sql +SELECT `posts.created_at` FROM `posts` +``` + +In case the `reselect` clause is not used, + +```ruby +Post.select(:title, :body) +``` + +the SQL executed would be: + +```sql +SELECT `posts.title`, `posts.body` FROM `posts` +``` + ### `reorder` The `reorder` method overrides the default scope order. For example: |