Rails 3 邮件程序从表单获取数据
我有一个电子邮件操作..简单的链接:
<%= link_to 'Send offer by mail', offer_to_mail_car_path(@car) %>
这个应该向管理员邮件发送一条通知,告知某些客户正在为这辆车提供特定金额的资金。因此,客户必须在表格中插入他的电子邮件和报价。这些数据不存储在数据库中,仅用于发送电子邮件和清除。因此,目前我确实收到了包含汽车数据、名称、图片网址等的电子邮件。但是我如何构建一个表单来显示这两个字段以及客户电子邮件和报价、控制器的外观以及链接本身。感谢您宝贵的时间。
控制器:
def offer_to_mail
@car = Car.find(params[:id])
CarMailer.offer_to_mail(@car).deliver
redirect_to @car, :notice => "Offer sent."
end
I have an e-mail action.. simple link:
<%= link_to 'Send offer by mail', offer_to_mail_car_path(@car) %>
this one should send a notification to the admin mail that some client is offering a specific amount of money for this car. So the client must insert in to a form his email and his offer. This data are not stored in database, it's just for sending email and clear out. So for now I do recieve email with car data, name, urls to pictures etc.. but how do I build a form to show up those 2 fields with clients email and offer, how the controller will look and the link itself. Thanks for your priceless time.
controller:
def offer_to_mail
@car = Car.find(params[:id])
CarMailer.offer_to_mail(@car).deliver
redirect_to @car, :notice => "Offer sent."
end
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
感谢我的一位朋友,我得到了答案。我将在这里发布解决方案,因为可能有人也需要这个。
在汽车邮件程序中,将
在 cars_controller 中
进行操作,并且视图中的表单将是:
现在是电子邮件模板 request_by_mail.html.erb
I got the answer thanks to a friend of mine. I'll post here the solution cause may be some one need this too.
in car mailers will do
in cars_controller
and the view where the form will be:
now the e-mail template request_by_mail.html.erb