knewter/grape_demo — pull request #2 by dblock (2012-02-20 17:50:43+00:00)
Title: Rackup with grape and with Rack::TryStatic

The problem is that TryStatic uses Rack::File, which throws 405 on any invalid method instead of falling through. So this is a little hackier, but it will basically split the requests in two: API and everything else.

Note how I changed attributes, you don't want to do "except" in the API writes. In general you would also need to validate parameters or the UI can write all kinds of nonsense to the model. We do this with a whitelist of attributes.