9
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Rails + Heroku + Postgres で日本語の order がうまくいかない対処法

Posted at
  • Rails 5.0.0
  • Ruby 2.3.0

ActiveRecord

'カラム名 COLLATE "C" ASC' と書けばいける。
scope で定義しちゃうと楽。

class Anime < ApplicationRecord
  scope :order_title, -> { order('title COLLATE "C" ASC') }
end

呼び出し

@animes = Anime.all.order_title

参考

9
6
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
9
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?