Cross Reference: categories_controller.rb
xref
: /
ontohub
/
app
/
controllers
/
categories_controller.rb
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
categories_controller.rb revision 08a490bd597c5ab72fe9938a42961bfa918c468b
class
CategoriesController
<
InheritedResources
::
Base
respond_to
:
json
belongs_to
:
ontology
,
optional
:
true
before_filter
:
check_read_permissions
load_and_authorize_resource
def
index
unless
params
[:
ontology_id
]
@
c_vertices
= []
if
vert
=
Category.first
@
c_vertices
=
vert.roots.first.children
end
end
super
end
def
show
@
category
=
Category.find
(
params
[:
id
])
@
ontologies
= @
category.related
_ontologies
end
protected
def
check_read_permissions
authorize
! :
show
,
parent.repository
if
parent.is
_a
?
Ontology
end
end