Skip to content

Commit

Permalink
Step 5: Rendering from templates
Browse files Browse the repository at this point in the history
  • Loading branch information
Carl Lerche committed Aug 27, 2009
1 parent d08f1b4 commit a5da103
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion sinatrails.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,17 @@ def _set_sessions(value)
end
end

# Halt can be implemented by simply throwing.
def halt(body = "")
throw(:halt, body)
end

# The default behavior is that the action's return value
# is the response body.
def process_action(*)
self.response_body = super
# We are now catching the throw that could be sent
# when halting from a before callback.
self.response_body = catch(:halt) { super }
end
end
end

0 comments on commit a5da103

Please sign in to comment.