Cross Reference: application_controller.rb
xref
: /
ontohub
/
app
/
controllers
/
application_controller.rb
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
application_controller.rb revision 7b025f9d9726413eb3f50ca2b39826e7eed816fb
class
ApplicationController
<
ActionController
::
Base
protect_from_forgery
# CanCan Authorization
rescue_from
CanCan
::
AccessDenied
do
|
exception
|
redirect_to
root_url
, :
alert
=>
exception.message
end
protected
helper_method
:
admin
?
def
admin
?
current_user.try
(:
admin
?)
end
def
authenticate_admin
!
unless
admin
?
flash
[:
error
] =
"you need admin privileges for this action"
redirect_to
:
root
end
end
end