Class: FcrepoAdmin::AssociationsController

Inherits:
ApplicationController
  • Object
show all
Includes:
Controller::ControllerBehavior
Defined in:
app/controllers/fcrepo_admin/associations_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



11
12
# File 'app/controllers/fcrepo_admin/associations_controller.rb', line 11

def index
end

#showObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'app/controllers/fcrepo_admin/associations_controller.rb', line 14

def show
  if @association.nil?
    render :text => "Association not found", :status => 404
  elsif @association.collection?
    @response, @documents = get_collection_from_solr
  else 
    # This shouldn't normally happen b/c UI links directly to target object view in this case
    # but we'll handle it gracefully anyway.
    target = @object.send("#{@association.name}_id")
    if target
      redirect_to :controller => 'objects', :action => 'show', :id => target, :use_route => 'fcrepo_admin'
    else
      render :text => "Target not found", :status => 404
    end
  end
end