Cross Reference: base.rb
xref
: /
ontohub
/
app
/
controllers
/
polymorphic_resource
/
base.rb
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
base.rb revision c503ff8f66c1a2896938cec77ad3d59979bcdae8
#
# Indexes, creates and deletes entries of a collection
# To be subclassed
#
class
PolymorphicResource
::
Base
<
InheritedResources
::
Base
actions
:
index
, :
create
def
create
authorize
! :
create
,
build_resource
resource.user
=
current_user
super
do
|
format
|
format.html
do
if
resource.errors.empty
?
render
:
partial
=>
resource
else
render
:
partial
=>
'form'
, :
status
=> :
unprocessable_entity
end
end
end
end
def
destroy
authorize
! :
destroy
,
resource
resource.destroy
head
:
ok
end
end