How can I send a welcome email to newly registered users in Rails using Devise?

前端 未结 5 1172
误落风尘
误落风尘 2020-12-24 14:06

I am using Devise on Rails and I\'m wondering if there is a hook or a filter that I can use to add a bit of code to Devise\'s user registration process and send a welcome em

5条回答
  •  星月不相逢
    2020-12-24 14:44

    I would recommend using a ActiveRecord::Observer. The idea with the observer is that you would create a class with an after_save method that would call the notification. All you need to do is create the observer class and then modify the application configuration to register the observer. The documentation describes the process quite well.

    Using the observer pattern means you do not need to change any logic in the controller.

提交回复
热议问题