When trying to request JSON from a resource not owned by a User, despite the validation I wrote below, the JSON shows up as empty brackets, but the status comes back as 200 OK. What do I need to change to respond with a 401 status:
@requested_resource = params[:resource_id].to_i
@users_resources = Resource.owned_by(@current_user.id).collect {|s| s.id}
if @users_resources.include?(@requested_resource)
else
respond_to do |format|
format.json { render :json => [], :status => :unauthorized }
format.html { render :file => "public/401.html", :status => :unauthorized }
end
end
Also, I am using RABL...