Sha256: 0bdf29e642ccf09130ac5468baf438eaaecaaa1902d18f201c5967b6f9b6634e

Contents?: true

Size: 487 Bytes

Versions: 7

Compression:

Stored size: 487 Bytes

Contents

module Rostra
  module EmailNotifier

    def self.included(base)
      base.after_create :notify_followers
    end

    private

    # Send email notification to everyone who is following the question. Of course,
    # don't send notification to the person that created the answer/comment.
    #
    def notify_followers
      question.followers.each do |user|
        next if self.user == user
        ApplicationMailer.notification(user, question).deliver
      end
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rostra-0.0.15 lib/rostra/email_notifier.rb
rostra-0.0.14 lib/rostra/email_notifier.rb
rostra-0.0.13 lib/rostra/email_notifier.rb
rostra-0.0.12 lib/rostra/email_notifier.rb
rostra-0.0.11 lib/rostra/email_notifier.rb
rostra-0.0.10 lib/rostra/email_notifier.rb
rostra-0.0.9 lib/rostra/email_notifier.rb