views:

48

answers:

1

Everytime a registerd user updates their profile, I would like the administrator to get an email notification about this.

In Drupal notification module will do this need

How can this be done in rails?

+4  A: 

Check out ActiveRecord::Observer.

class UserObserver < ActiveRecord::Observer
    observe :userprofile
    def after_save(userprofile)
      Notifier.deliver_comment("[email protected]", "The profile for #{userprofile.username} has changed.", userprofile)
    end
end
Jonas Elfström
This is using ActionMailer (http://api.rubyonrails.org/classes/ActionMailer/Base.html) to do the actual email sending.
mikej
Thanks for clearing that up!
Jonas Elfström