We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 68af636 + 2ef1de0 commit 2a0a264Copy full SHA for 2a0a264
guides/source/active_record_querying.md
@@ -1266,6 +1266,18 @@ class Client < ActiveRecord::Base
1266
end
1267
```
1268
1269
+NOTE: The `default_scope` is also applied while creating/building a record.
1270
+It is not applied while updating a record. E.g.:
1271
+
1272
+```ruby
1273
+class Client < ActiveRecord::Base
1274
+ default_scope { where(active: true) }
1275
+end
1276
1277
+Client.new # => #<Client id: nil, active: true>
1278
+Client.unscoped.new # => #<Client id: nil, active: nil>
1279
+```
1280
1281
### Merging of scopes
1282
1283
Just like `where` clauses scopes are merged using `AND` conditions.
0 commit comments