Class: Concepts::SchemeController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/concepts/scheme_controller.rb

Overview

Copyright 2011-2013 innoQ Deutschland GmbH

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Instance Method Summary collapse

Instance Method Details

#editObject



54
55
56
57
# File 'app/controllers/concepts/scheme_controller.rb', line 54

def edit
  @scheme = Iqvoc::Concept.root_class.instance
  authorize! :update, @scheme
end

#showObject



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'app/controllers/concepts/scheme_controller.rb', line 38

def show
  @scheme = Iqvoc::Concept.root_class.instance
  authorize! :read, @scheme

  @top_concepts = Iqvoc::Concept.base_class
                      .preload(:pref_labels)
                      .tops
                      .not_expired
                      .published.sort_by {|c| c.pref_label }

  respond_to do |format|
    format.html
    format.any(:rdf, :ttl, :nt)
  end
end

#updateObject



59
60
61
62
63
64
65
66
67
68
69
70
# File 'app/controllers/concepts/scheme_controller.rb', line 59

def update
  @scheme = Iqvoc::Concept.root_class.instance
  authorize! :update, @scheme

  if @scheme.update(concept_params)
    flash[:success] = t('txt.controllers.concept_scheme.save.success')
    redirect_to scheme_path
  else
    flash[:error] = t('txt.controllers.concept_scheme.save.error')
    render :edit
  end
end