I have a before_filter that validates an API key. If the key is invalid, I would like to process the response only on the 403 header.
In my controller:
before_filter :validate_api ... def validate_api if params[:api_key].present? and ApiKey.find(params[:api_key]) return true else render head :forbidden end end
The problem is that I get a DoubleRender error, presumably when Rails goes into action and tries to display the response anyway. As far as I understand, Rails prevents the action from executing if before_filter displays or redirects. Is that not so?
How to visualize the response only for the header in the before_filter file and prevent the execution of actions?
source share