开发者

Ruby on Rails Error in rake db:migrate syntax error, unexpected $end, expecting '}'

I get this error when I run rake db:migrate *db/migrate//004_add_data_to_measurement_type_and_measurement_unit.rb:3: invalid multibyte char (US-ASCII) db/migrate//004_add_data_to_measuremen开发者_开发百科t_type_and_measurement_unit.rb:3: invalid multibyte char (US-ASCII) db/migrate//004_add_data_to_measurement_type_and_measurement_unit.rb:3: syntax error, unexpected $end, expecting '}' ...celeration' => [{:name =>'m/s²', :si => true, :conversion_f...*

Then I checked it using *$ ruby -wc db/migrate/004_add_data_to_measurement_type_and_measurement_unit.rb* and got the same error.

I was sure that I have all the right gems in place, so I tested by removing the superscript in the line, making it :name =>'m/s' from :name =>'m/s²'. This removed the error.

But problem is that I need the superscript and do not know how previous developer managed to run the db:migrate on this. Have you seen something similar?

Thanks


The problem is that the superscript is not ASCII.

The previous developer may have set something so that UTF-8 was always assumed, but you should be able to do it for this script specifically by adding the magic comment

# coding: utf-8

near the top of the script.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜