Class: UserObserver

Inherits:
ActiveRecord::Observer
  • Object
show all
Defined in:
app/models/user_observer.rb

Instance Method Summary collapse

Instance Method Details

#after_create(user) ⇒ Object



2
3
4
# File 'app/models/user_observer.rb', line 2

def after_create(user)
  Authengine::UserMailer.(user).deliver
end

#after_save(user) ⇒ Object



6
7
8
9
10
11
12
13
# File 'app/models/user_observer.rb', line 6

def after_save(user)
  # the next line causes deprecation warnings in
  # actionmailer/lib/actionmailer/adv_attr_accessor.rb
  # this could become fatal when the deprecated methods are removed
  Authengine::UserMailer.activation(user).deliver if user.pending? # pending? true if user is activated
  Authengine::UserMailer.forgot_password(user).deliver if user.recently_forgot_password?
  Authengine::UserMailer.reset_password(user).deliver if user.recently_reset_password?
end