Browse files

Tweaks and extensions to README.

  • Loading branch information...
baldowl committed Feb 4, 2009
1 parent 63f5a8a commit 9f870d3337c0ac4d576f637f9a3b2b8385272e75
Showing with 23 additions and 10 deletions.
  1. +23 −10
@@ -68,8 +68,21 @@ as your `Article` model supports a `comments` association proxy, then the `finde
and `record` options for `Comment` will automatically scope their results by
the parent `Article`.
-**Note:** Currently, only one level of nesting is supported. Here's a Lighthouse
-ticket for the issue: [](
+## Limiting routes
+By default, Sinatra's Hat creates seven routes for each mounted model (the
+four ones for <acronym title="Create|Read|Update|Destroy">CRUD</acronym>
+actions plus the routes for index, new and edit action), but you can reduce
+the number of available routes with `only`:
+mount Article do
+ only :index, :show
+Only the listed actions will return valid responses; requests for the
+"missing" routes will produce 404 "Not Found" HTTP responses.
## Basic Auth
@@ -109,6 +122,8 @@ call `to_#{format}` on the record object. That means that with most ORMs,
things like `to_xml`, `to_json`, and `to_yaml` will be supported right out
of the box.
+Requests for unknow formats will produce 406 "Not Acceptable" HTTP responses.
## Default Flows
Sinatra's Hat has some default flows:
@@ -144,6 +159,11 @@ mount Article do
+Only `:create` and `:update` actions allow to handle success and failure
+differently; for the other actions you can customize only the `success` result
+and if something goes wrong (i.e., when a record cannot be found) they will
+simply return a 404 "Not Found" HTTP response.
### `redirect` options
When specifying a custom redirect, you can pass one of a few things:
@@ -205,18 +225,11 @@ end
* Make `last_modified` calls more efficient
* Investigate other forms of caching
-## Other Features
-I'll be writing docs for the following topics soon:
-* Specifying which actions to generate
-* Protecting actions with basic auth
## Other Info
* [View the Lighthouse Project](
* [View the CI build](
* Thanks a ton to the [Sinatra team]( for such an
awesome framework.
-(c) Copyright 2008-2009 Pat Nakajima. All Rights Reserved.
+(c) Copyright 2008-2009 Pat Nakajima. All Rights Reserved.

0 comments on commit 9f870d3

Please sign in to comment.