diff --git a/app/controllers/tasks_controller.rb b/app/controllers/tasks_controller.rb index d2012319..57bff129 100644 --- a/app/controllers/tasks_controller.rb +++ b/app/controllers/tasks_controller.rb @@ -17,7 +17,7 @@ class TasksController < ApplicationController def create @task = Task.new(params[:task]) - if @task.save + if @task.errors.empty? && @task.save flash[:notice] = "Aufgabe wurde erstellt" if @task.workgroup redirect_to :action => "workgroup", :id => @task.workgroup @@ -40,8 +40,7 @@ class TasksController < ApplicationController def update @task = Task.find(params[:id]) @task.attributes=(params[:task]) - if @task.errors.empty? - @task.save + if @task.errors.empty? && @task.save flash[:notice] = "Aufgabe wurde aktualisiert" if @task.workgroup redirect_to :action => "workgroup", :id => @task.workgroup diff --git a/app/models/task.rb b/app/models/task.rb index b1f9de3a..f32e6ebd 100644 --- a/app/models/task.rb +++ b/app/models/task.rb @@ -29,6 +29,8 @@ class Task < ActiveRecord::Base # extracts nicknames from a comma seperated string # and makes the users responsible for the task + # TODO: check for uniqueness + # TODO: check for maximal number of users def user_list=(string) @user_list = string.split(%r{,\s*}) new_users = @user_list - users.collect(&:nick)