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。
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。
转载于:https://www.cnblogs.com/lmei/p/3320935.html