Class: IssueObserver

Inherits:
ActiveRecord::Observer
  • Object
show all
Defined in:
app/models/issue_observer.rb

Overview

– copyright ChiliProject is a project management system.

Copyright (C) 2010-2013 the ChiliProject Team

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

See doc/COPYRIGHT.rdoc for more details. ++

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#send_notificationObject

Wrap send_notification so it defaults to true, when it's nil


28
29
30
# File 'app/models/issue_observer.rb', line 28

def send_notification
  @send_notification
end

Instance Method Details

#after_create(issue) ⇒ Object


18
19
20
21
22
23
24
25
# File 'app/models/issue_observer.rb', line 18

def after_create(issue)
  if self.send_notification
    (issue.recipients + issue.watcher_recipients).uniq.each do |recipient|
      Mailer.deliver_issue_add(issue, recipient)
    end
  end
  clear_notification
end