aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source
diff options
context:
space:
mode:
authorr11runner <r11runner@gmail.com>2015-10-31 23:36:27 +0100
committerr11runner <r11runner@gmail.com>2015-10-31 23:36:27 +0100
commitdb45df361a38112dd67a861a18d0b60c3dd6ae6a (patch)
tree1fab21f1c6c743b85524170734d361c72900ba07 /guides/source
parentb217354dbbbbb49a020b0073ebb62c5cd2d96140 (diff)
downloadrails-db45df361a38112dd67a861a18d0b60c3dd6ae6a.tar.gz
rails-db45df361a38112dd67a861a18d0b60c3dd6ae6a.tar.bz2
rails-db45df361a38112dd67a861a18d0b60c3dd6ae6a.zip
[ci skip] querying guide methods first and last: mentioning the influence of the default scope
Diffstat (limited to 'guides/source')
-rw-r--r--guides/source/active_record_querying.md4
1 files changed, 4 insertions, 0 deletions
diff --git a/guides/source/active_record_querying.md b/guides/source/active_record_querying.md
index b7773ea65a..ec31fa9d67 100644
--- a/guides/source/active_record_querying.md
+++ b/guides/source/active_record_querying.md
@@ -185,6 +185,8 @@ SELECT * FROM clients ORDER BY clients.id ASC LIMIT 1
The `first` method returns `nil` if no matching record is found and no exception will be raised.
+If your [default scope](active_record_querying.html#applying-a-default-scope) contains an order method, `first` will return the first record according to this ordering.
+
You can pass in a numerical argument to the `first` method to return up to that number of results. For example
```ruby
@@ -221,6 +223,8 @@ SELECT * FROM clients ORDER BY clients.id DESC LIMIT 1
The `last` method returns `nil` if no matching record is found and no exception will be raised.
+If your [default scope](active_record_querying.html#applying-a-default-scope) contains an order method, `last` will return the last record according to this ordering.
+
You can pass in a numerical argument to the `last` method to return up to that number of results. For example
```ruby