Ruby 对外文字符的支持
摘要:通常Rails应用程序都习惯使用英文作为源码的编码格式。由于项目要求,在数据库表名以及字段名需要使用外文字符。经过调查。这种需求可以实现。使用方法如下:1.在使用到外文字符的源码文件头上加上“# encoding: utf-8”,注意必须在文件第一行第一列开始2.文件名使用英文3.类名使用英文4.migration文件采用如下方式:# encoding: utf-8class AddChineseTalbe < ActiveRecord::Migration def change create_table :你好 do |t| t.string :你的 t.stri...
阅读全文
posted @ 2013-10-25 08:33