Fixed previous style "improvement"

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

@ -59,22 +59,17 @@ module API
def write_request_valid? def write_request_valid?
contract = WorkPackageContract.new(@representer.represented, current_user) contract = WorkPackageContract.new(@representer.represented, current_user)
contract_valid = contract.validate return true if contract.validate && @representer.represented.valid?
represented_valid = @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|
@representer.represented.errors.add(key, message)
end
end
false # We need to merge the contract errors with the model errors in
# order to have them available at one place.
contract.errors.keys.each do |key|
contract.errors[key].each do |message|
@representer.represented.errors.add(key, message)
end
end end
false
end end
end end

Loading…
Cancel
Save