robfig/revel — pull request #245 by ScruffyProdigy (2013-07-26 22:02:22+00:00)
Title: Adding in RestfulRoutes

CHANGES:
changed parseRoutes() to allow a RESOURCE route method, which will
create a series of other routes

If the Controller has a pluralized name, it will create a route for
each of the following methods it finds in the controller: Index, New,
Create, Show, Edit, Update, Destroy

If the Controller has a singularized name, it will create a route for
these methods instead:
New, Create, Show, Edit, Update, Destroy

QUESTIONS:
Are there any other tests I should write?

COMMENTS:
As most web browsers don't natively have a way to create PUT or DELETE requests, I added the following Filter when I did integration testing right before the RouterFilter:

func(c *revel.Controller, fc []revel.Filter) {
method := c.Request.Request.FormValue("_method")
if method != "" {
c.Request.Request.Method = strings.ToUpper(method)
}
fc[0](c,fc[1:])
}

And added `` into my HTML forms. (This is very similar to how Rails performs)

In order to have an out of the box experience, we might need to do something similar