Skip to content
Kris Leech edited this page Jun 24, 2014 · 1 revision

Use build_resource to get access to the user model and subscribe a listener.

class RegistrationsController < Devise::RegistrationsController
  def build_resource(sign_up_params)                                                       
    super.subscribe(RegistrationMailer.new)                                                 
  end
end
class User < ActiveRecord::Base
  include Wisper::Publisher

  after_create do
    publish(:user_created, self)
  end
end

Another option is to globally subscribe a listener meaning you don't need to create a custom devise controller like in the above example.