导轨触发控制器从击中mailto按钮? [英] rails trigger controller from hitting mailto button?
问题描述
= mail_to boss.email:subject => boss.subj ,
:body =>hi boss,:action =>'home#mail'
有无论如何可以让mail_to打开一个新窗口到我的邮箱?
现在当我打到mail_to然后选择Gmail(firefox ubuntu),然后我直接去gmail ...
我希望它在新窗口中打开...无论如何在rails中执行它?
请阅读 http://api.rubyonrails.org/classes/ActionView/Helpers /UrlHelper.html#method-i-mail_to 。它不提供
:action => 'home#mail'
加入到mail_to方法中。这将简单地打开您的默认电子邮件客户端并填写主题,电子邮件地址和正文的值。如果你想在控制器中调用一个动作,你必须用link_to来完成。并考虑为此任务使用 ActionMailer ...
In rails, I want the user to hit the mailto button and then call the method 'mail' in controller 'home' , how you do that??
Here is my code, it seems doesnt work well...
= mail_to boss.email :subject=>boss.subj,
:body=>"hi boss", :action=>'home#mail'
And is there anyway can make mail_to open a new windows to my mail box?
now when I hit mail_to and then select gmail (firefox ubuntu), then I go straight to gmail...
I want it open in new windows... anyway to do it in rails?
please read http://api.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html#method-i-mail_to exactly. It does not make sens to provide
:action => 'home#mail'
to the mail_to method. This will simply open your default email client and fill in the values for subject, email address and body. If you want to call a action in a controller, you have to do it with link_to. And think about using ActionMailer for this task ...
这篇关于导轨触发控制器从击中mailto按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!