I want to return an HTTP 401 error as part of my permission_denied method for declarative_authorization .
permission_denied
# triggered when a user accesses a page that they don't have access to def permission_denied # render my default 401 error page? end
How should I do it? (Pardon the question if this is stupid ... I know how to make the 401.html page in my public directory, but I donβt think it returns the 401 HTTP header, and thatβs what I follow.)
You can add an option :status
:status
def permission_denied render :file => "public/401.html", :status => :unauthorized end