Displaying 1 result from an estimated 1 matches for "adminaccessreqired".
2007 Jul 31
2
controller exceptions
...nce Merb has the lovely property of rendering the output of an
action, using ruby-level exceptions to render error pages in Merb
could be a cute way to approach error handling.
Suppose one has an action for editing a product which you would like
to restrict to administrators:
def edit
raise AdminAccessReqired unless session[:user] and session[:user].admin?
@product = Product.find(params[:id])
raise UnknownProduct if @product.nil?
render
end
Where AdminAccessReqired and UnknownProduct are ControllerExceptions.
The controller exception hierarchy would be rooted with the base
class, Merb::C...