Module: AsyncJob::ControllerMethods

Includes:
Client
Defined in:
lib/async_job/controller_methods.rb

Defined Under Namespace

Modules: Client

Instance Method Summary collapse

Methods included from Client

#render_job_queued

Instance Method Details

#showObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/async_job/controller_methods.rb', line 11

def show
  results = AsyncJob::Results.find(params[:id])

  if results.results
    logger.debug "Returning async job results: #{results.inspect}"
    if results.success?
      if stale?(:etag => results.results)
        render :json => results.results, :status => :ok
      end
    else
      render :json => results.results, :status => :unprocessable_entity
    end
    results.destroy
  else
    render_job_queued(results)
  end
end