sts
sts

Reputation: 2357

Notification in rails

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?

Upvotes: 0

Views: 226

Answers (1)

Jonas Elfström
Jonas Elfström

Reputation: 31428

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

Upvotes: 4

Related Questions