问题
I would like to do the following to insert a styled mail_to
:
<%= mail_to @colleague.email do %>
<span class="email" id="colleague_40"> Reply by Email </span>
<% end %>
The RoR docs aren't specific on the topic of mail_to
blocks but the above code doesn't seem to work. Is there a way to do a block in conjunction with mail_to
?
回答1:
<% mail_content = capture do %>
<span class="email" id="colleague_40"> Reply by Email </span>
<% end %>
<%= mail_to @colleague.email, mail_content %>
来源:https://stackoverflow.com/questions/7062407/using-mail-to-with-a-block-mail-to-do