diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2018-11-28 14:53:11 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-28 14:53:11 -0500 |
commit | a01e0d0fabeef83e690f6eaf714ecd28b8f211a7 (patch) | |
tree | 24e528b4033cfafa8c28800fece11ea4052f8641 /guides | |
parent | 00638f31d1f5c914bac32c5f00cb0e0693274b99 (diff) | |
parent | 7e4eeca3708d8e9085fa1a539e72a5a6f139b4b6 (diff) | |
download | rails-a01e0d0fabeef83e690f6eaf714ecd28b8f211a7.tar.gz rails-a01e0d0fabeef83e690f6eaf714ecd28b8f211a7.tar.bz2 rails-a01e0d0fabeef83e690f6eaf714ecd28b8f211a7.zip |
Merge pull request #34534 from gmcgibbon/ar_query_scope_body_doc
Clarify scope body requirements
Diffstat (limited to 'guides')
-rw-r--r-- | guides/source/active_record_querying.md | 2 |
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: |