Permalink
Browse files

Complete action for projects, using observer

  • Loading branch information...
1 parent ee59358 commit 895d9f9d225e819e0877549d6efb6a18e503407a @lubson committed Feb 21, 2012
Showing with 15 additions and 0 deletions.
  1. +6 −0 app/observers/project_observer.rb
  2. +4 −0 app/views/projects/complete.js.erb
  3. +5 −0 spec/models/project_observer_spec.rb
@@ -0,0 +1,6 @@
+class ProjectObserver < ActiveRecord::Observer
+
+ def before_update(project)
+ project.tasks.update_all(status: :complete) if project.status == 'completed'
+ end
+end
@@ -0,0 +1,4 @@
+$(document).ready(function(){
+ $('.projects-menu .active').removeClass('active');
+ $('.projects-menu .status-completed').addClass('active');
+});
@@ -0,0 +1,5 @@
+require 'spec_helper'
+
+describe ProjectObserver do
+ pending "add some examples to (or delete) #{__FILE__}"
+end

0 comments on commit 895d9f9

Please sign in to comment.