Tag: haml

Rails应用程序不使用我的xls视图

我有以下的行动: def users_report @users = Kid.where(confirmation_token: nil).paginate(:page => params[:page], :per_page => 30) respond_to do |format| format.html format.xls { send_data @users.to_csv(col_sep: "\t") } end end 此外,我有两个意见“users_report.html.haml”和“users_report.xls.erb”,但是当我按下导出到Excel的button,我得到文件users_report.xls,但我只能看到对象,但users_report.xls .erb的结构是按列排列的所有字段。 任何人都可以在这里帮我吗? 提前致谢 更新XLS视图 <?xml version="1.0"?> <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40"> <Worksheet ss:Name="Sheet1"> <Table> <Row> <Cell><Data ss:Type="String">Name</Data></Cell> <Cell><Data ss:Type="String">Surname</Data></Cell> <Cell><Data ss:Type="String">Email</Data></Cell> <Cell><Data ss:Type="String">Age</Data></Cell> <Cell><Data ss:Type="String">School</Data></Cell> <Cell><Data ss:Type="String">Class</Data></Cell> <Cell><Data ss:Type="String">Native […]