Created
December 11, 2014 16:57
-
-
Save nyaahara/2d2e4111fbe87b5d587b to your computer and use it in GitHub Desktop.
scopeでwhereしてorder(nullを含める)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# hogeがnullのレコードが下になってソートされます。 | |
scope :sorted_hoge_with_null, -> { where(status: :none).order('hoge IS NULL, hoge ASC') } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment