2010-07-16 31 views

回答

0

我以前遇到同樣的問題,但那時我選擇不縮進代碼。

也許你可以做一個幫助方法,刪除縮進(假設你不想在你的郵件縮進)。喜歡的東西:

<% no_indentation do %> 
    Here goes my content. 
    <% if @show_extra %> 
    And this is some extra indented text 
    <% end %> 
<% end %> 

,然後在助手:

#some_helper.rb 
module MyHelper 
    def no_indentation(&block) 
    #Capture the content of the block, 
    #and replace multiple spaces/tabs with a single space. 
    end 
end 

我還沒有嘗試過這一點我自己,但它可能是值得一試。

+0

謝謝,這是有效的。無論如何,我決定使用HTML作爲內容類型來更好地控制顯示。 – 2010-07-16 13:32:07