2016-04-18 12 views
0

以下のコードでは、構文エラーが発生しています。例外キャッチ構文エラーレールボタン

誰かが私をここで助けることができますか?

<%= button_tag :class => 'pull-right margin-clear btn btn-sm btn-default-transparent btn-animated notify-class', :type => :submit, 
     :id =>"notify-class<%=product.master.id%>" :style=>'display:none'  
     :data-toggle => "modal" , :data-target => "#myModal" >   
     Notify me!<i class="fa fa-bell" style ="margin-left: 10px;"></i> 
    <% end %> 
+0

あなたはどのような構文エラーを取得しているが? – Anand

+0

'構文エラー、予期しない ':'、expecting ')' ... @ output_buffer.safe_append = '":style => \'表示:なし\ '\' d ... ...^' – Suraj

答えて

1

あなたは前にカンマが欠落している:スタイルと前:データトグル - ここでは修正されたコードです:

<%= button_tag :class => 'pull-right margin-clear btn btn-sm btn-default-transparent btn-animated notify-class', :type => :submit, 
     :id =>"notify-class<%=product.master.id%>", :style=>'display:none',  
     :data-toggle => "modal" , :data-target => "#myModal" >   
     Notify me!<i class="fa fa-bell" style ="margin-left: 10px;"></i> 
    <% end %> 
+0

はい、それそれを指摘してくれてありがとう。 – Suraj

0

まず第一に、あなたはあなたのbutton_tagの終わりにdoが必要になります。

<%= button_tag :class => 'pull-right margin-clear btn btn-sm btn-default-transparent btn-animated notify-class', :type => :submit, 
    :id =>"notify-class<%=product.master.id%>" :style=>'display:none'  
    :data-toggle => "modal", :data-target => "#myModal" do %>   
    Notify me! <i class="fa fa-bell" style ="margin-left: 10px;"></i> 

第二に、あなたは"notify-class<%=product.master.id%>"を修正する必要があります。私はあなたがここで何をしようとしているのか正確には分かりませんが、あなたのbutton_tagのために<%= %> ERBタグを既存の<%=%>内に注入しています。文字列を補間しようとしている場合は"notify-class#{product.master.id}"を使用してください。productが定義されている限り動作します。

関連する問題