0
我嘗試應該得到button_to但沒有qoutes軌button_to單quoute
取代報價在渲染
button_to "Delete",
radio_tag_path(tag),
:method=>:delete,
:class=>:destroy,
:confirm=>"Are you sure?"
輸出
<form action="/radio/tags/654" class="button_to" method="post">
<div>
<input name="_method" type="hidden" value="delete" />
<input class="destroy" data-confirm="Are you sure?" type="submit" value="Delete" />
<input name="authenticity_token" type="hidden" value="eXM0McnTzuhnYIxrLLYF7kjp76fdMdZpq6HPc++ogog=" />
</div>
</form>
,但我需要沒有qoutes
比我渲染
(button_to "Delete",
radio_tag_path(tag),
:method=>:delete,
:class=>:destroy,
:confirm=>"Are you sure?"
).gsub('\"','\'')
但隨後,輸出類似html_safe
<form action="/radio/tags/654" class="button_to" method="post"><div><input name="_method" type="hidden" value="delete" /><input class="destroy" data-confirm="Are you sure?" type="submit" value="Delete" /><input name="authenticity_token" type="hidden" value="eXM0McnTzuhnYIxrLLYF7kjp76fdMdZpq6HPc++ogog=" /></div></form>
我怎麼能去掉引號,但仍使用html標籤
你爲什麼要更換雙引號? – jvnill
你是說你想刪除標籤屬性的所有引號?雖然其中一些將是不帶引號的有效HTML,但如果刪除了所有引號,則會導致HTML無效。你通過這樣做想達到什麼目的? – Planty
答案似乎很簡單,但爲什麼要這樣做呢? – Bigxiang