Reputation: 16469
All I want to do is send notification emails to myself. I do not need a template at the moment. I am currently getting the error:
Template Missing
Missing template home/send_mail, application/send_mail with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:erb, :builder, :raw, :ruby, :coffee, :jbuilder]}. Searched in: * "/Users/bli1/.rvm/gems/ruby-2.1.3/gems/web-console-2.0.0.beta4/lib/action_dispatch/templates" * "/Users/bli1/Development/RoR/Boothie/app/views" * "/Users/bli1/.rvm/gems/ruby-2.1.3/gems/web-console-2.0.0.beta4/app/views"
Route:
match '/send_mail', to: "home#send_mail", via: "get"
Controller:
class HomeController < ApplicationController
def index
end
def send_mail
ActionMailer::Base.mail(:from => "[email protected]", :to => "[email protected]", :subject => "Contact request", :body => "test").deliver
end
end
Upvotes: 0
Views: 82
Reputation: 22926
Cancel the render using:
def send_mail
ActionMailer::Base.mail(:from => "[email protected]", :to => "[email protected]", :subject => "Contact request", :body => "test").deliver
render nothing: true
end
Upvotes: 2