Cross Reference: formality_levels_controller.rb
xref
: /
ontohub
/
app
/
controllers
/
formality_levels_controller.rb
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
formality_levels_controller.rb revision 0c1a668aa5722b52a11ff165a61f77cab968e27f
class
FormalityLevelsController
<
InheritedResources
::
Base
belongs_to
:
ontology
,
optional
:
true
before_filter
:
check_read_permissions
respond_to
:
html
load_and_authorize_resource
def
create
create
!
do
|
success
,
failure
|
if
parent
parent.formality
_level
=
resource
parent.save
end
success.html
{
redirect_to
[*
resource_chain
, :
formality_levels
] }
end
end
def
update
update
!
do
|
success
,
failure
|
success.html
{
redirect_to
[*
resource_chain
, :
formality_levels
] }
end
end
def
destroy
destroy
!
do
|
success
,
failure
|
success.html
{
redirect_to
[*
resource_chain
, :
formality_levels
] }
end
end
protected
def
check_read_permissions
authorize
! :
show
,
parent.repository
if
parent.is
_a
?
Ontology
end
end