Class: TaskObserver
- Inherits:
-
ActiveRecord::Observer
- Object
- ActiveRecord::Observer
- TaskObserver
- Defined in:
- app/models/observers/task_observer.rb
Overview
Fat Free CRM Copyright © 2008-2011 by Michael Dvorkin
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <www.gnu.org/licenses/>.
Constant Summary collapse
- @@tasks =
{}
Instance Method Summary collapse
Instance Method Details
#after_update(item) ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'app/models/observers/task_observer.rb', line 27 def after_update(item) original = @@tasks.delete(item.id) if original return log_activity(item, :complete) if item.completed_at && original.completed_at.nil? return log_activity(item, :reassign) if item.assigned_to != original.assigned_to return log_activity(item, :reschedule) if item.bucket != original.bucket end end |
#before_update(item) ⇒ Object
23 24 25 |
# File 'app/models/observers/task_observer.rb', line 23 def before_update(item) @@tasks[item.id] = Task.find(item.id).freeze end |