2011-12-16 59 views
1

创建具有类似下面的迁移一个简单的模型将打破耙分贝:迁移任务:如何在Rails迁移中使用UTF8字符?

class CreateProducts < ActiveRecord::Migration 
    def change 
    create_table :products do |t| 
     t.string :title 
     t.float :price, :default => "0.00" 
     t.string :currency, :default => "€" 

     t.timestamps 
    end 
    end 
end 

交换与EUR修复该问题暂时但总的来说我喜欢的欧元符号理解我怎么可能在那里使用作为默认值。

干杯

回答

3

将这个上迁移文件的第一行:

# encoding: utf-8 
+0

哇,这让我吃惊...我想这件事情,我不会再见到我后离开PHP的世界。 ..无论如何感谢 – pagid 2011-12-16 18:06:31