我正在關注this SE問題,將表單放入引導程序模式並使用rails。 回答問題的人聲明:「確保每個模態身體都有唯一的ID或類。」所以我想在我的link_to中添加一個唯一的ID號碼:link_to與嵌入式ruby中的數據切換
<%= link_to "Edit", edit_post_path(post.id), :class => "btn", :remote => true, "data-toggle" => "modal", "data-target" => "<%= post.id %>-my-modal" %>
但是這樣做會導致錯誤。如果我拿出<%= post.id%>我沒有錯誤,但模式行爲不起作用。
如何添加帶有嵌入式ruby的post.id到鏈接?