Most likely this is the problem of sorting using PostgreSQL:
The collation function allows you to specify the sort order and nature of data classification for a column or even for each operation. This makes it easier to limit the impossibility of changing the LC_COLLATE and LC_CTYPE parameters in the database after it is created.
Rails. - :
class FixCollationForAbbr < ActiveRecord::Migration
def up
execute 'ALTER TABLE universities ALTER COLUMN abbr TYPE varchar COLLATE "ru_RU";'
end
end
, database.yml:
defaults: &defaults
adapter: postgresql
encoding: utf8
collation: ru_RU.utf8
ctype: ru_RU.utf8
database.yml PostgreSQL:
def create_database(name, options = {})
options = { encoding: 'utf8' }.merge!(options.symbolize_keys)
option_string = options.inject("") do |memo, (key, value)|
memo += case key
...snip...
when :encoding
" ENCODING = '#{value}'"
when :collation
" LC_COLLATE = '#{value}'"
when :ctype
" LC_CTYPE = '#{value}'"
...snip...
end
end
execute "CREATE DATABASE #{quote_table_name(name)}#{option_string}"
end