0
在Rails 3.2.1幫助程序中有以下代碼,即使我不需要它,我仍然會轉義HTML,並且我無法弄清楚如何關閉此方法中的html轉義(調用生或html_safe不工作):Rails HTML轉義
module OffersHelper
def price_tag(amount)
amount = amount.to_f
floor = amount.floor
cents = ((amount - amount.floor) * 100).to_i
content_tag(:h2) do
html = floor.to_s
html << content_tag(:sup, cents) if cents > 0
html
end
end
end
如果我刪除嵌套content_tag(SUP的標籤),將HTML轉義關閉...
燦你詳細說明你是如何調用'raw' /'html_safe'?你如何渲染字符串? – 2012-03-05 18:37:36