文章列表
ruby中的中文乱码问题
ruby文件中如果有中文,在命令行运行的时候会报错,解决方法:中文通过iconv转换一下,并且在文件头上加入:#encoding:utf-8,如:
#encoding:utf-8
require "iconv"
s = "abc中国"
puts s.length
puts Iconv.conv("gbk", "utf-8", s)
表单开始标签:
<%= form_tag { :action => :save }, { :method => :post } %>
Use :multipart => true to define a Mime-Multipart form (for file uploads)
表单结束标签:
<%= end_form_tag %>
文本框 Text fields
<%= text_field :modelname, :attribute_name, options %>
生成:
<input type="text& ...