diff options
author | Robin Houston <robin.houston@gmail.com> | 2012-08-01 14:39:18 +0100 |
---|---|---|
committer | Robin Houston <robin.houston@gmail.com> | 2012-08-01 14:39:18 +0100 |
commit | 67a3a43cc26f8ad7218f33a13af04c3c74347866 (patch) | |
tree | 3fc5f27905332ba4647915eb5823d3d37615fe4c /app/controllers/api_controller.rb | |
parent | c1d2580892033d28ff05f3d47cee78aaef963c29 (diff) | |
parent | cc3268df4c9de319ea16aa99238e3c4c40dae7c5 (diff) |
Merge branch 'develop' into wdtk
Diffstat (limited to 'app/controllers/api_controller.rb')
-rw-r--r-- | app/controllers/api_controller.rb | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/app/controllers/api_controller.rb b/app/controllers/api_controller.rb index 4db07b4c9..a7853c787 100644 --- a/app/controllers/api_controller.rb +++ b/app/controllers/api_controller.rb @@ -71,10 +71,18 @@ class ApiController < ApplicationController end + def _get_attachments_from_params(params) + attachments = [] + params.each_pair do |k, v| + attachments << v if v.is_a? Tempfile + end + return attachments + end + def add_correspondence request = InfoRequest.find(params[:id]) json = ActiveSupport::JSON.decode(params[:correspondence_json]) - attachments = params[:attachments] + attachments = _get_attachments_from_params(params) direction = json["direction"] body = json["body"] @@ -147,12 +155,12 @@ class ApiController < ApplicationController :filename => filename ) end - mail = RequestMailer.create_external_response(request, body, sent_at, attachment_hashes) request.receive(mail, mail.encoded, true) end - - head :no_content + render :json => { + 'url' => make_url("request", request.url_title), + } end def body_request_events |