1

尝试在 Ruby on Rails 应用程序中使用 HAML 创建文件上传表单。代码非常小而且直截了当:

= form_tag player_salary_path, :multipart=>true
  = file_field_tag :file
  = submit_tag "Import"

错误:

syntax error, unexpected keyword_ensure, expecting end-of-input
4

1 回答 1

4

你忘了把它变成一个do...end块。您需要将 do 添加到第一行的末尾。见下文:

= form_tag player_salary_path, :multipart=>true do
  = file_field_tag :file
  = submit_tag "Import"
于 2013-11-04T00:41:55.723 回答