Cross Reference: oops_requests_controller.rb
xref
: /
ontohub
/
app
/
controllers
/
oops_requests_controller.rb
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
oops_requests_controller.rb revision 71aa56b17dc7e472110a8267b5efc7baa84bff05
class
OopsRequestsController
<
ApplicationController
respond_to
:
json
before_filter
:
check_creatable
, :
only
=> :
create
def
show
raise
ActiveRecord
::
RecordNotFound
,
'Not Found'
unless
resource
respond_with
resource
end
def
create
respond_to
do
|
format
|
ontology_version.create
_oops_request
!
format.json
do
respond_with
(*
resource_chain
,
ontology_version
,
resource
)
end
format.html
do
flash
[:
notice
] =
"Your request is send to OOPS!"
redirect_to
repository_ontology_path
(*
resource_chain
)
end
end
end
protected
def
ontology
Ontology.find
(
params
[:
ontology_id
])
end
def
ontology_version
ontology.versions.where
(
number
:
params
[:
ontology_version_id
])
.
first
!
end
def
resource
ontology_version.request
end
def
check_creatable
unless
ontology_version.oops
_request_creatable
?
head
:
forbidden
end
end
end