lib/happy/controller/actions.rb in happy-0.1.0.pre11 vs lib/happy/controller/actions.rb in happy-0.1.0.pre12
- old
+ new
@@ -30,9 +30,16 @@
# Set response body and finish request
response.body = [data]
halt!
end
+ def serve_or_404!(*args)
+ serve!(*args)
+
+ # If we get here, #serve! decided not to serve, so let's raise a 404.
+ raise Errors::NotFound
+ end
+
def halt!(message = :done)
throw message
end
def redirect!(to, status = 302)