0

i have to develop a mailer using ruby on rails and i keep getting that error, I don't know how to correct it, I have tried a lot of methods. This is my code

class ApplicationMailer < ActionMailer::Base

  layout 'application_mailer'

  def mailer(user)
    @user = user
    mail to: user.email, subject: "Welcome"
  end
end
Pavan
  • 33,316
  • 7
  • 50
  • 76

1 Answers1

0

create mailer.html.erb under app/views/application_mailers

mailer action need view to render so it is searching for application_mailers/mailer.html.erb which is missing I think

Sachin R
  • 11,606
  • 10
  • 35
  • 40
  • i have one in views/layout, I have to make another in app/mailer? – Donato Tovar Aug 23 '17 at 15:56
  • Prueba <%= csrf_meta_tags %> <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>

    Hello <%= @user.email %>

    That is the code i have in the .html.erb

    – Donato Tovar Aug 23 '17 at 16:04
  • That is your application_mailer layout file but you need another one app/views/application_mailers/mailer.html.erb – Sachin R Aug 23 '17 at 16:07
  • I also have one with this code. <%= yield %>

    Hello <%= @user.email %>

    – Donato Tovar Aug 23 '17 at 16:11