Search code examples
ruby-on-railsruby-on-rails-3devise

Notifying an admin of a new registration using Devise


All of my users will be unapproved until they are approved by an admin, the admin will be logging into the site to mark the user as approved. I am following the Devise docs here which is working out great but how do I send an email to the admin once a new user has signed up so that the admin is aware and can approve the sign up?


Solution

  • How about in your User model, do something like this:

    after_create :send_admin_mail
    def send_admin_mail
       ###Send email stuff here
    end
    

    You may want to use ActionMailer.

    There may be some built in Devise way, but I can't find anything. This basically just sends an alert to you.