我可以弄清楚为什么这个简单的代码无法编译。可能是新鲜的眼睛会看到我所缺少的。
<table>
<tr>
<th></th>
<th><%=h "Name <Email>" %></th>
<th>Role</th>
</tr>
<% project.participations.each do |participation| %>
<tr>
<%= div_for(participation) do %>
<td>some stuff</td>
<td>more stuff</td>
<% end %>
</tr>
<% end %>
</table>
我收到错误
compile error
/Users/leonid/Documents/rails_apps/appdepot/app/views/projects/_show_participants.html.erb:9:语法错误,意外')' ......((div_for(参与)do).to_s); @ output_buffer.concat ... ^ /Users/leonid/Documents/rails_apps/appdepot/app/views/projects/_show_participants.html.erb:14:语法错误,意外的kEND,期待')' ;结束 ; @ output_buffer.concat“\ n \ n” ^ /Users/leonid/Documents/rails_apps/appdepot/app/views/projects/_show_participants.html.erb:31:语法错误,意外的kENSURE,期待')' /Users/leonid/Documents/rails_apps/appdepot/app/views/projects/_show_participants.html.erb:33:语法错误,意外的kEND,期待')'
答案 0 :(得分:3)
<%= div_for(participation) do %>
应该是
<% div_for(participation) do %>
前面没有等号