Fixed previous style "improvement"

pull/2505/head
Alexander Bach 10 years ago
parent 65c39db9cf
commit dcc33a826e
  1. 11
      lib/api/v3/work_packages/work_packages_api.rb

@ -59,16 +59,12 @@ module API
def write_request_valid?
contract = WorkPackageContract.new(@representer.represented, current_user)
contract_valid = contract.validate
represented_valid = @representer.represented.valid?
return true if contract.validate && @representer.represented.valid?
if contract_valid && represented_valid
true
else
# We need to merge the contract errors with the model errors in
# order to have them available at one place.
contract.errors.each do |key, messages|
messages.each do |message|
contract.errors.keys.each do |key|
contract.errors[key].each do |message|
@representer.represented.errors.add(key, message)
end
end
@ -76,7 +72,6 @@ module API
false
end
end
end
before do
@work_package = WorkPackage.find(params[:id])

Loading…
Cancel
Save