mirror of
https://github.com/TracksApp/tracks.git
synced 2025-09-22 05:50:47 +02:00
show dependency validation errors in action edit form
This commit is contained in:
parent
fd8f4e2b32
commit
bba13194fd
1 changed files with 10 additions and 1 deletions
|
@ -423,7 +423,16 @@ class TodosController < ApplicationController
|
|||
update_dependencies
|
||||
update_attributes_of_todo
|
||||
|
||||
@saved = @todo.save
|
||||
begin
|
||||
@saved = @todo.save!
|
||||
rescue ActiveRecord::RecordInvalid => exception
|
||||
record = exception.record
|
||||
if record.is_a?(Dependency)
|
||||
record.errors.each { |key,value| @todo.errors[key] << value }
|
||||
end
|
||||
@saved = false
|
||||
end
|
||||
|
||||
|
||||
# this is set after save and cleared after reload, so save it here
|
||||
@removed_predecessors = @todo.removed_predecessors
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue