0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Ruby on Rails 開発メモ

Posted at

開発中のメモを備忘録程度にまとめます。(随時更新)

##メイラーに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
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?