提交 2ef1de02 编写于 作者: M Mauro George

Add a note about default_scope and create records

[ci skip]
上级 cc7ef0cf
......@@ -1266,6 +1266,18 @@ class Client < ActiveRecord::Base
end
```
NOTE: The `default_scope` is also applied while creating/building a record.
It is not applied while updating a record. E.g.:
```ruby
class Client < ActiveRecord::Base
default_scope { where(active: true) }
end
Client.new # => #<Client id: nil, active: true>
Client.unscoped.new # => #<Client id: nil, active: nil>
```
### Merging of scopes
Just like `where` clauses scopes are merged using `AND` conditions.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册