[英]Rails Tutorial 7.4.3 SyntaxError in UsersController#show
[英]SyntaxError in Campaign_groups#show
我已經看了很多,只是找不到語法錯誤,我不斷得到:
compile error
/home/durrantm/code/it_trunk/webapp/app/views/campaign_groups/_cgs_overview.html.erb:36: syntax error, unexpected kELSE, expecting ')'
; else ; @output_buffer.concat "\n ...
^
/home/durrantm/code/it_trunk/webapp/app/views/campaign_groups/_cgs_overview.html.erb:40: syntax error, unexpected kEND, expecting ')'
; end ; @output_buffer.concat "\n\n"
^
/home/durrantm/code/it_trunk/webapp/app/views/campaign_groups/_cgs_overview.html.erb:43: syntax error, unexpected kENSURE, expecting ')'
/home/durrantm/code/it_trunk/webapp/app/views/campaign_groups/_cgs_overview.html.erb:45: syntax error, unexpected kEND, expecting ')'
該頁面的完整代碼(_cgs_overview.html.erb)為:
<% if @campaign_group.campaigns.count > 0 %>
<%=# render :partial => 'show_offer_images' %>
<div class="overview">
<table class="show_activity show_overview">
<tr>
<th>Unique Shoppers</th>
<td id="overview-shoppers" class="clearable">-</td>
</tr>
<tr>
<th>Issuances</th>
<td id="overview-issuances" class="clearable">-</td>
</tr>
<tr>
<th>Redemptions</th>
<td title="Redemption rate does not include informational campaigns" id="overview-redemptions" class="clearable">-</td>
</tr>
<tr>
<th>Total Cost</th>
<td id="overview-cost" class="clearable">-</td>
</tr>
<tr>
<th>Products</th>
<td id="overview-products" class="clearable">-</td>
</tr>
</table>
</div>
<div style="clear:both;"></div>
<div style="width:300px; padding-bottom: 10px">
<%=# link_to("<<", campaign_group_path(params[:id], :offer_images_offset_for_pagination => @previous_images_to_paginate )) %>
<%=# link_to(">>", campaign_group_path(params[:id], :offer_images_offset_for_pagination => @next_images_to_paginate )) %>
<%=# link_to(">ajax>", :remote => true, :action => 'show_offer_images', :campaign_group_id => params[:id], :offer_images_offset_for_pagination => @next_images_to_paginate ) %>
</div>
<% else %>
<p style="font-size:120%;font-style:italic;margin:140px 0 160px;">
There are no campaigns in this group.
</p>
<% end %>
如果讓erb
通過-x
開關向您顯示紅寶石代碼,您將看到
... _erbout.concat((# render :partial ...)); _erbout.concat "\n"
注意#
哈希如何注釋掉整行代碼。 這條線和其他三個類似的詞是“ expecting ')'
的原因。
搜索erb注釋指向在erb中添加注釋的最佳方法,在該方法中 ,我們得知您應將<%=# ... %>
替換為<%#= ... %>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.