2

次のコードを使用して、HAML のオプションのドロップダウン リストをレンダリングしています。

  - @campaigns.each do |campaign|
    %tr{class: 'tr_' + cycle('odd', 'even'), id: "#{campaign.to_param}"}
      %td= link_to campaign.name, campaign
      %td= campaign.synopsis
      %td= campaign.focus_area
      %td= number_to_currency(campaign.goal_in_dollars)
      %td= campaign.approval_requested_at //line 34
      %td= link_to 'Approve', approve_admin_campaign_path(campaign)//line 35
      %td= form_tag({controller: "admin/campaign", action: "deny"}, method: "post") do //line 36
      = text_field_tag :reason, params[:reason] //line 37
      = submit_tag("Deny") //line 38

ただし、エラーが発生します。

/Users/user/rails_projects/wdi/app/views/admin/campaigns/index.haml:34: syntax error, unexpected ')'
));}</td>\n      #{_hamlout.fo...
 ^
/Users/user/rails_projects/wdi/app/views/admin/campaigns/index.haml:36: unknown regexp options - tr
/Users/user/rails_projects/wdi/app/views/admin/campaigns/index.haml:36: syntax error, unexpected $undefined
));}\n    </tr>\n", -1, false);end;_hamlout.p...
                ^
/Users/user/rails_projects/wdi/app/views/admin/campaigns/index.haml:39: unknown regexp options - dv
/Users/user/rails_projects/wdi/app/views/admin/campaigns/index.haml:39: syntax error, unexpected $undefined
...end;_hamlout.push_text("</div>\n", -1, false);::Haml::Util.h...
...                               ^
/Users/user/rails_projects/wdi/app/views/admin/campaigns/index.haml:39: unterminated string meets end of file
/Users/user/rails_projects/wdi/app/views/admin/campaigns/index.haml:39: syntax error, unexpected $end, expecting keyword_end

このエラーはどこから来ていますか? 括弧や改行文字を追加していません

4

1 に答える 1

2

form タグはインデントされていません。に変更します

%td
  = form_tag({controller: "admin/campaign", action: "deny"}, method: "post") do //line 36
    = text_field_tag :reason, params[:reason] //line 37
    = submit_tag("Deny")
于 2013-07-17T17:20:07.370 に答える