Sha256: a63edd7c88a31816a429aff3731de004b3003475260ffad9908be8c1afbfd728

Contents?: true

Size: 502 Bytes

Versions: 15

Compression:

Stored size: 502 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, self, question).deliver
      end
    end

  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
rostra-0.3.6 lib/rostra/email_notifier.rb
rostra-0.3.5 lib/rostra/email_notifier.rb
rostra-0.3.4 lib/rostra/email_notifier.rb
rostra-0.3.3 lib/rostra/email_notifier.rb
rostra-0.3.2 lib/rostra/email_notifier.rb
rostra-0.3.1 lib/rostra/email_notifier.rb
rostra-0.2.1 lib/rostra/email_notifier.rb
rostra-0.2.0 lib/rostra/email_notifier.rb
rostra-0.1.26 lib/rostra/email_notifier.rb
rostra-0.1.25 lib/rostra/email_notifier.rb
rostra-0.1.24 lib/rostra/email_notifier.rb
rostra-0.1.23 lib/rostra/email_notifier.rb
rostra-0.1.22 lib/rostra/email_notifier.rb
rostra-0.1.21 lib/rostra/email_notifier.rb
rostra-0.1.20 lib/rostra/email_notifier.rb