RESTful request with parameters?


I've implemented a restful app where I can post comments. If I use I get all the comments for program 1

In the main page of the programs I can see all the programs and the LAST comment for each program. That I use a helper function that just takes the last comment.

Now. I want to do the same thing but the response is sent to a client in xml. So I can and again I get xml for all the comments.

What is the best way to request the last comment? Using the same request but adding a parameter? Creating a custom action?


I would add a parameter instead of a custom action:


In your controller, you can look at params[:filter] to find out what kind of filter the client wants - you could support values like last, first, or a number if they want to simply limit the result set.


Jeff Cohen wrote:

I would add a parameter instead of a custom action:


Yeah I'll do it like that. Somehow I get the feeling that adding parameters to a clean restful request breaks the rest rules. But I guess that is a normal way of doing it.