Sha256: 9a4aabb3da53d258860f4706d4bfb674b3cec4d27d9a16c130268baea60e5426

Contents?: true

Size: 496 Bytes

Versions: 20

Compression:

Stored size: 496 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.notified_followers.each do |user|
        next if self.user == user
        ApplicationMailer.notification(user, question).deliver
      end
    end

  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
rostra-0.1.19 lib/rostra/email_notifier.rb
rostra-0.1.18 lib/rostra/email_notifier.rb
rostra-0.1.17 lib/rostra/email_notifier.rb
rostra-0.1.16 lib/rostra/email_notifier.rb
rostra-0.1.15 lib/rostra/email_notifier.rb
rostra-0.1.14 lib/rostra/email_notifier.rb
rostra-0.1.13 lib/rostra/email_notifier.rb
rostra-0.1.12 lib/rostra/email_notifier.rb
rostra-0.1.10 lib/rostra/email_notifier.rb
rostra-0.1.9 lib/rostra/email_notifier.rb
rostra-0.1.8 lib/rostra/email_notifier.rb
rostra-0.1.7 lib/rostra/email_notifier.rb
rostra-0.1.6 lib/rostra/email_notifier.rb
rostra-0.1.5 lib/rostra/email_notifier.rb
rostra-0.1.4 lib/rostra/email_notifier.rb
rostra-0.1.3 lib/rostra/email_notifier.rb
rostra-0.1.2 lib/rostra/email_notifier.rb
rostra-0.1.1 lib/rostra/email_notifier.rb
rostra-0.0.17 lib/rostra/email_notifier.rb
rostra-0.0.16 lib/rostra/email_notifier.rb