2014-01-22 62 views
1

我想通過Rails在頁面的標題中顯示html標籤。我使用Rails 2.3我已經試過這些方式Rails在頁面的標題中不顯示html標籤

<title><%= raw @agent_event_monitor.name %></title> 
<title><%= @agent_event_monitor.name.html_safe %></title> 
<title><pre><code><%= @agent_event_monitor.name.html_safe %></code></pre></title> 
<title><%= h(@agent_event_monitor.name) %></title> 

但沒有不給上@ agent_event_monitor.name任何結果是這樣的

<b><p>Hello</p></b> 
+3

你怎麼在HTML代碼中的所有4個場景中看到了什麼? – emaillenin

+0

我剛剛看過你好 – KarenManukyan

+0

不,emallein意味着你看到了哪些html代碼? –

回答

0

我能夠複製場景。請看下圖:

enter image description here

在application.haml:

%title= "<b><p>Hello</p></b>".html_safe 
相關問題