Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Rubymineによれば、これが受け入れられる理由を知っている人はいますかwhere({name: 'Jim'})?where(name: 'Jim')
where({name: 'Jim'})
where(name: 'Jim')
「ファインダまたは計算メソッドに条件を指定することは非推奨です。」
Rails 3.x より前のメソッド群で必要であった:conditionsように、 query メソッドにオプションを指定する必要がなくなったためです。条件のハッシュを直接渡すだけです。たとえば、これの代わりに:wherefindwhere
:conditions
where
find
where(conditions: {name: 'Bob'})
あなたは単に呼び出すことができます:
where(name: 'bob')