You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
flyerhzm edited this page Aug 13, 2010
·
3 revisions
Before:
class Project < ActiveRecord::Base
after_create :send_create_notifications
private
def send_create_notifications
self.members.do |member|
ProjectMailer.deliver_notification(self, member)
end
end
end
After:
class Project < ActiveRecord::Base
# nothing here
end
class ProjectNotificationObserver < ActiveRecord::Observer
observe Project
def after_create(project)
project.members.each do |member|
ProjectMailer.deliver_notice(project, member)
end
end
end