Googleで検索すると
User.where('name IS NOT NULL')
=> SELECT `users`.* FROM `users` WHERE (name IS NOT NULL)
みたいな書き方が出てくるけど、
User.where.not(name: nil)
=> SELECT `users`.* FROM `users` WHERE (`users`.`name` IS NOT NULL)
の方が美しいし安全です。
Go to list of users who liked
More than 5 years have passed since last update.
Googleで検索すると
User.where('name IS NOT NULL')
=> SELECT `users`.* FROM `users` WHERE (name IS NOT NULL)
みたいな書き方が出てくるけど、
User.where.not(name: nil)
=> SELECT `users`.* FROM `users` WHERE (`users`.`name` IS NOT NULL)
の方が美しいし安全です。
Register as a new user and use Qiita more conveniently
Go to list of users who liked