Rails -- filename去除扩展名简单例子:params[:upload]['preview'].original_filename 的值为templateOne.html.erb template_name = File.basename(params[:upload]['preview'].original_filename, ".html.erb").to_s获得的template_name的值为templateOne。