LoginSignup
1
0

More than 5 years have passed since last update.

Rails+heroku+postgreSQLでnilを最後にしてorderする

Last updated at Posted at 2018-08-01

それぞれ取得して、あとで+で結合する。

    @novels_like_not_null = @osusume.novels.where.not(like: nil).order(like: :DESC)
    @novels_like_null = @osusume.novels.where(like: nil)
    @novels = @novels_like_not_null+@novels_like_null

もっと綺麗なやり方があるかもしれない。。。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0