Fix task validation again #16; mark assignment validation TODO
This commit is contained in:
parent
e561ddb064
commit
d086fe7cc7
2 changed files with 4 additions and 3 deletions
|
@ -17,7 +17,7 @@ class TasksController < ApplicationController
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@task = Task.new(params[:task])
|
@task = Task.new(params[:task])
|
||||||
if @task.save
|
if @task.errors.empty? && @task.save
|
||||||
flash[:notice] = "Aufgabe wurde erstellt"
|
flash[:notice] = "Aufgabe wurde erstellt"
|
||||||
if @task.workgroup
|
if @task.workgroup
|
||||||
redirect_to :action => "workgroup", :id => @task.workgroup
|
redirect_to :action => "workgroup", :id => @task.workgroup
|
||||||
|
@ -40,8 +40,7 @@ class TasksController < ApplicationController
|
||||||
def update
|
def update
|
||||||
@task = Task.find(params[:id])
|
@task = Task.find(params[:id])
|
||||||
@task.attributes=(params[:task])
|
@task.attributes=(params[:task])
|
||||||
if @task.errors.empty?
|
if @task.errors.empty? && @task.save
|
||||||
@task.save
|
|
||||||
flash[:notice] = "Aufgabe wurde aktualisiert"
|
flash[:notice] = "Aufgabe wurde aktualisiert"
|
||||||
if @task.workgroup
|
if @task.workgroup
|
||||||
redirect_to :action => "workgroup", :id => @task.workgroup
|
redirect_to :action => "workgroup", :id => @task.workgroup
|
||||||
|
|
|
@ -29,6 +29,8 @@ class Task < ActiveRecord::Base
|
||||||
|
|
||||||
# extracts nicknames from a comma seperated string
|
# extracts nicknames from a comma seperated string
|
||||||
# and makes the users responsible for the task
|
# and makes the users responsible for the task
|
||||||
|
# TODO: check for uniqueness
|
||||||
|
# TODO: check for maximal number of users
|
||||||
def user_list=(string)
|
def user_list=(string)
|
||||||
@user_list = string.split(%r{,\s*})
|
@user_list = string.split(%r{,\s*})
|
||||||
new_users = @user_list - users.collect(&:nick)
|
new_users = @user_list - users.collect(&:nick)
|
||||||
|
|
Loading…
Reference in a new issue