Class: ParentsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/parents_controller.rb

Overview

Nested under receptacles controller, redirects the user to the upstream asset, or provides a disambiguation page if there are multiple. Used by clients of the ML Warehouse to provide links to multiplexed library tubes without us needing to expose the id of the library tube itself. (Or for the user to track it) Note: Parents go via requests here, not transfer requests or asset links.

Instance Method Summary collapse

Methods inherited from ApplicationController

#block_api_access, #clean_params_from_check, #evil_parameter_hack!, #extract_header_info, #set_cache_disabled!

Instance Method Details

#showObject


10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/controllers/parents_controller.rb', line 10

def show
  @child = child
  @parents = @child.source_receptacles

  if @parents.empty?
    render :show, status: :not_found
  elsif @parents.one?
    redirect_to receptacle_path(@parents.first)
  else
    render :show, status: :multiple_choices
  end
end