Using mail_to with a block (mail_to … do)

 ̄綄美尐妖づ 提交于 2019-12-12 13:13:08

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!