2017/04/01分のコミットです。
CHANGELOGへの追加はありませんでした。
Add default_scope note to AR guide [ci skip]
rails guideのActive Record Query Interface
の修正です。
Applying a default scope
の項に、scope argumentにArray
を渡した場合とHash
を渡した場合の挙動の違いについての説明を追加しています。
class Client < ApplicationRecord default_scope { where(active: true) } end Client.new # => #<Client id: nil, active: true> Client.unscoped.new # => #<Client id: nil, active: nil> class Client < ApplicationRecord default_scope { where("active = ?", true) } end Client.new # => #<Client id: nil, active: nil>