我正在开发 Rails 3 应用程序,我需要将 html 代码传递给字符串变量并将其作为参数传递给 Web 服务。
我有以下代码,里面有循环,但由于它是在字符串中声明的,所以它不适用于 <%%> 和 #{} 标记
@emaildata = "<H3>FLOOR VIEW ACTION REQUEST</H3>
<table border='0' cellspacing='4'>
<tr>
<td>Submitted On:</td>
<td align='left'><strong>#{Date.today}</strong></td>
</tr>
<tr>
<td> Originator: </td>
<td align='left'><strong>#{session[:user_name]}</strong></td>
</tr>
</table>
<table border=0 width=100%>
<tr bgcolor='##006699'>
<td align='center'><font color='##FFFFFF'><strong>ACTION CODE</strong></font></td>
<td align='center'><font color='##FFFFFF'><strong>PART<BR />NUMBER</strong></font></td>
<td align='center'><font color='##FFFFFF'><strong>LOCATION</strong></font></td>
<td align='center'><font color='##FFFFFF'><strong>BIN QTY</strong></font></td>
<td align='center'><font color='##FFFFFF'><strong>PACK QTY</strong></font></td>
<td align='center'><font color='##FFFFFF'><strong>UM</strong></font></td>
<td align='center'><font color='##FFFFFF'><strong>SCAN CODE</strong></font></td>
<td align='center'><font color='##FFFFFF'><strong>REASON / COMMENTS</strong></font></td>
</tr>
<% (1..PartNoListInEmail.length).each_index do |i|%>
<tr bgcolor='##E0E5E5'>
<td align='center'>#{@ActionCodeListInEmail[i]}</td>
<td align='center'>#{@PartNoListInEmail[i]}</td>
<td align='center'>#{@SendToListInEmail[i]}</td>
<td align='center'>#{@OrderQtyListInEmail[i]}</td>
<td align='center'>#{@PackQtyListInEmail[i]}</td>
<td align='center'>#{@UMListInEmail[i]}</td>
<td align='center'>#{@ScancodeListInEmail[i]}</td>
<td align='center'>#{@reasonForActionIn[i]}</td>
</tr>
<%end%>
</table>"
请帮我 。