当我在邮件视图中缩进代码时,我也会在发送的(纯文本)邮件中看到缩进。有没有办法避免这种情况而无需编写我的代码而无需缩进......?
问问题
433 次
1 回答
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
我自己没有尝试过,但值得一试。
于 2010-07-16T12:19:51.013 回答