Fix task validation #16
This commit is contained in:
parent
95efe554fc
commit
e561ddb064
2 changed files with 3 additions and 4 deletions
|
@ -17,14 +17,13 @@ class TasksController < ApplicationController
|
|||
|
||||
def create
|
||||
@task = Task.new(params[:task])
|
||||
if @task.errors.empty?
|
||||
@task.save
|
||||
if @task.save
|
||||
flash[:notice] = "Aufgabe wurde erstellt"
|
||||
if @task.workgroup
|
||||
redirect_to :action => "workgroup", :id => @task.workgroup
|
||||
else
|
||||
redirect_to :action => "index"
|
||||
end
|
||||
end
|
||||
else
|
||||
render :template => "tasks/new"
|
||||
end
|
||||
|
|
|
@ -11,7 +11,7 @@ class Task < ActiveRecord::Base
|
|||
attr_protected :users
|
||||
|
||||
validates_length_of :name, :minimum => 3
|
||||
validates_numericality_of :duration, :required_users, :only_integer => true, :greater_than => 1
|
||||
validates_numericality_of :duration, :required_users, :only_integer => true, :greater_than_or_equal_to => 1
|
||||
|
||||
after_save :update_ordergroup_stats
|
||||
|
||||
|
|
Loading…
Reference in a new issue