尽管电子邮件发送正确,但Rails错误查找actionmailer模板

时间:2015-08-21 18:24:40

标签: ruby-on-rails actionmailer

我有一个带有邮件的乘客运行的rails应用程序。我有它所以操作后的页面显示了电子邮件内容,但我收到此错误:

String#to_i

尽管如此,电子邮件在发送时仍能正确加载模板。它仅在导致问题的视图中显示它。

rfis_controller.rb:

result.to_i.is_a? Numeric

rfi_mailer.rb:

Missing template rfis/mail, application/mail with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:erb, :builder, :raw, :ruby, :coffee, :slim, :jbuilder]}. Searched in: * "/var/www/rqm3/app/views" * "/usr/local/rvm/gems/ruby-2.1.5/gems/devise-3.5.1/app/views" * "/usr/local/rvm/gems/ruby-2.1.5/gems/twitter-bootstrap-rails-3.2.0/app/views"

send_rfi.html.erb:

  def mail
    @mail_message = RfiMailer.send_rfi(current_user, @rfi).deliver
  end

1 个答案:

答案 0 :(得分:2)

问题是由于您没有重定向方法内的任何内容" mail"定义内部控制器

 def mail
   @mail_message = RfiMailer.send_rfi(current_user, @rfi).deliver
   redirect_to @user, notice: "Message sent successfully ."
 end

你也可以定义任何渲染