Reputation: 969
I have a rails app running on passenger with a mailer. I have it so the page following the action shows the email content but I get this error:
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"
despite this, the email does correctly load the template when being sent. It's only showing it in a view that causes issues.
rfis_controller.rb:
def mail
@mail_message = RfiMailer.send_rfi(current_user, @rfi).deliver
end
rfi_mailer.rb:
class RfiMailer < ApplicationMailer
default from:"[email protected]"
def send_rfi(user, rfi)
mail(to:"[email protected]")
end
end
send_rfi.html.erb:
test
Upvotes: 0
Views: 92
Reputation: 2781
Issue is due to you are not redirecting anything inside your method "mail" define inside controller
def mail
@mail_message = RfiMailer.send_rfi(current_user, @rfi).deliver
redirect_to @user, notice: "Message sent successfully ."
end
you can also define render nothing
Upvotes: 2