Skip to content

Commit bc6a7f6

Browse files
committed
Cast into String because some orders start with 0
0 means octal number in Ruby, which breaks when sorting: e.g. puts 010 => 8
1 parent a56b5ee commit bc6a7f6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/tasks/dojos.rake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ namespace :dojos do
2424
desc '現在のyamlファイルを元にデータベースを更新します'
2525
task update_db_by_yaml: :environment do
2626
dojos = Dojo.load_attributes_from_yaml
27-
dojos.sort_by{ |hash| hash['order'] }
27+
dojos.sort_by{ |hash| hash['order'].to_s }
2828

2929
dojos.each do |dojo|
3030
d = Dojo.find_by(name: dojo['name']) || Dojo.new
3131

3232
d.id = dojo['id']
3333
d.name = dojo['name']
3434
d.email = ''
35-
d.order = dojo['order']
35+
d.order = dojo['order'].to_s
3636
d.description = dojo['description']
3737
d.logo = dojo['logo']
3838
d.tags = dojo['tags']

0 commit comments

Comments
 (0)