avoid useless JSON roundtrip

know your library they said...
pull/2345/head
Jan Sandbrink 10 years ago
parent 9cc0806024
commit 5a575c6b10
  1. 8
      lib/api/v3/work_packages/work_packages_api.rb

@ -55,17 +55,17 @@ module API
# After Pass 1 the correct type information is merged into the WP
# In Pass 2 the representer is created with the new type info and will be able
# to also parse custom fields successfully
merge_json_into_work_package!(request_body.to_json)
merge_json_into_work_package!(request_body.to_json)
merge_hash_into_work_package!(request_body)
merge_hash_into_work_package!(request_body)
end
end
# merges the given JSON representation into @work_package
def merge_json_into_work_package!(json)
def merge_hash_into_work_package!(hash)
payload = Form::WorkPackagePayloadRepresenter.create(
@work_package,
enforce_lock_version_validation: true)
payload.from_json(json)
payload.from_hash(hash)
end
def request_body

Loading…
Cancel
Save