開発中のメモを備忘録程度にまとめます。(随時更新)
##メイラーに2つの引数を渡す
controller
def create
@contact = Contact.new(contact_params)
@user = current_user.email
if @contact.save
ContactMailer.contact_mail(@contact, @user).deliver
redirect_to blogs_path, notice: 'Contact was successfully created.'
else
render :new
end
end
mailer
class ContactMailer < ApplicationMailer
def contact_mail(contact, user)
@contact = contact
@user = user
mail to: @user, subject: "お問い合わせの確認メール"
end
end