aboutsummaryrefslogtreecommitdiffstats
path: root/guides
diff options
context:
space:
mode:
authorGannon McGibbon <gannon.mcgibbon@gmail.com>2018-11-26 13:42:27 -0500
committerGannon McGibbon <gannon.mcgibbon@gmail.com>2018-11-26 16:17:12 -0500
commit7e4eeca3708d8e9085fa1a539e72a5a6f139b4b6 (patch)
tree323e71215589c3006334b9369ee92484b4b476d8 /guides
parent713e75d46dc75274a996661ed3ff773bc481d7a5 (diff)
downloadrails-7e4eeca3708d8e9085fa1a539e72a5a6f139b4b6.tar.gz
rails-7e4eeca3708d8e9085fa1a539e72a5a6f139b4b6.tar.bz2
rails-7e4eeca3708d8e9085fa1a539e72a5a6f139b4b6.zip
Clarify scope body requirements
[ci skip]
Diffstat (limited to 'guides')
-rw-r--r--guides/source/active_record_querying.md2
1 files changed, 1 insertions, 1 deletions
diff --git a/guides/source/active_record_querying.md b/guides/source/active_record_querying.md
index 02055e59f0..fd1dcf22c0 100644
--- a/guides/source/active_record_querying.md
+++ b/guides/source/active_record_querying.md
@@ -1267,7 +1267,7 @@ This is because it is ambiguous whether they should appear on the parent record,
Scopes
------
-Scoping allows you to specify commonly-used queries which can be referenced as method calls on the association objects or models. With these scopes, you can use every method previously covered such as `where`, `joins` and `includes`. All scope methods will return an `ActiveRecord::Relation` object which will allow for further methods (such as other scopes) to be called on it.
+Scoping allows you to specify commonly-used queries which can be referenced as method calls on the association objects or models. With these scopes, you can use every method previously covered such as `where`, `joins` and `includes`. All scope bodies should return an `ActiveRecord::Relation` or `nil` to allow for further methods (such as other scopes) to be called on it.
To define a simple scope, we use the `scope` method inside the class, passing the query that we'd like to run when this scope is called: