Trigger a HTTP error in Rails
http-error, http-status-code-403, ruby-on-rails
Solution
In your controller code add the following line:
render :status => :forbidden, :text => "Forbidden fruit"
Refer to this page for http code to symbol mapping.
Problem
I'm trying to call a custom instance of a 403 HTTP error in Rails but I can't seem to figure out how to do this... I have several user authentication roles and basically if a role tries to browse to an area that it is not authorised to visit I want to display a 403 instead of just redirecting the user. How do I do this?