Module: RdfControllerLabelExtension

Defined in:
app/controllers/rdf_controller.rb

Overview

TODO: move out of /controllers

Instance Method Summary collapse

Instance Method Details

#showObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/controllers/rdf_controller.rb', line 5

def show
  scope = params[:published] == '0' ? Iqvoc::XLLabel.base_class.unpublished : Iqvoc::XLLabel.base_class.published
  if @label = scope.by_origin(params[:id]).with_associations.last
    respond_to do |format|
      format.html {
        redirect_to label_url(id: @label.origin, published: params[:published])
      }
      format.any(:rdf, :ttl, :nt) {
        authorize! :read, @label
        render 'labels/show'
      }
    end
  else
    super
  end
end