1

I'm using Shrine gem to allows user upload their document in devise registration form. There is a strange issue as below:

  • If no file is attached to registration form, confirmation email is sent successfully.

enter image description here

  • If user attached any file(cv image) to the form, confirmation email is not sent, it seem that send_on_create_confirmation_instructions callback is not called even there is a transaction commit event.

enter image description here

Tiktac
  • 966
  • 1
  • 12
  • 32
  • It looks like `shrine` gem override `after_commit` (https://github.com/shrinerb/shrine/blob/master/lib/shrine/plugins/activerecord.rb), so the method `send_on_create_confirmation_instructions` on `devise` gem which is called follow the `after_commit` callback, will not be called (https://github.com/heartcombo/devise/blob/master/lib/devise/models/confirmable.rb) – Lam Phan May 20 '21 at 10:43
  • 1
    so i guess the solution maybe creating another model for `cv` so the `user` model send confirmation email meanwhile the `cv` model will upload image. – Lam Phan May 20 '21 at 10:45
  • 1
    Thanks @LamPhan seems you are right, it works if I create a model to separate Shrine fields from user model. – Tiktac May 20 '21 at 12:17

0 Answers0