Skip to content

Instantly share code, notes, and snippets.

@carmelyne
Created February 15, 2009 04:18
Show Gist options
  • Save carmelyne/64599 to your computer and use it in GitHub Desktop.
Save carmelyne/64599 to your computer and use it in GitHub Desktop.
# more for routes
map.forgot_password '/forgot_password', :controller => 'users', :action => 'forgot_password'
map.reset_password '/reset_password', :controller => 'users', :action => 'reset_password'
# app/models/user_observer.rb
class UserObserver < ActiveRecord::Observer
def after_create(user)
UserNotifier.deliver_signup_notification(user)
end
def after_save(user)
UserNotifier.deliver_activation(user) if user.recently_activated?
UserNotifier.deliver_forgot_password(user) if user.recently_forgot_password?
UserNotifier.deliver_reset_password(user) if user.recently_reset_password?
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment