0

I have looked at this a lot and just cannot find the syntax error, I keep getting:

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 ')'

The entire code for the page (_cgs_overview.html.erb) is:

<% 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 )) %>&nbsp;&nbsp;
      <%=# link_to(">>", campaign_group_path(params[:id], :offer_images_offset_for_pagination => @next_images_to_paginate )) %>&nbsp;&nbsp;
      <%=# 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 %>
Michael Durrant
  • 93,410
  • 97
  • 333
  • 497

1 Answers1

1

If you let erb show you the ruby code, via the -x switch, you will see

... _erbout.concat((# render :partial ...)); _erbout.concat "\n"

Note how the # hash comments the whole rest of the line out. This line and three others like it are the cause for "expecting ')'".

Searching for erb comment points to Best way to add comments in erb where we learn that you should replace <%=# ... %> with <%#= ... %>

Community
  • 1
  • 1
Martin Vidner
  • 2,307
  • 16
  • 31