Confused about REST and custom actions

Thanks for the info and links guys. I have been researching it more
this week and its starting to sink in. I see what you mean about the
resource not being 1-to-1 with the model and it is a conceptual thing,
not the implementation. But I think most of the time in my app, the
resource will be pretty close to the model. Maybe you can help clarify
something for me, though. One resource is a widget and I will be using
the regular 7 rails actions for this. The users will be asking for a
collection of widgets, but in many different ways and criteria. The web
app is going to provide them with shortcuts so they can just click on a
certain type of collection. For example here are a few shortcuts (there
will probably be at least 20 of these):

Top 10 heaviest widgets
Top 10 lightest widgets
Top 10 most expensive widgets
Top 10 most popular widgets
etc....

So the resource they are looking for would be "Top 10 Most Popular
Widgets", right? Which would be a different resource from "Top 10
Heaviest Widgets". But I would not want to have a separate controller
for each of these, since they are all related to a widget collection.
How does this fit in with REST and the ruby implementation of REST? Do
I just code a bunch of different conditionals in /widgets and use a
"type" parameter -- /widgets?type=heaviest and then check for each of
these in the "def list"? It just makes more sense to me to create a
specific action for these "/widgets/heaviest". I think I'm still
confused :wink:

Robert,

This makes more sense now. Thanks for the explanation!

If anyone is interested, I decided to do it this way (from Agile Web
Development with Rails book) :

map.resources :widgets, :collection => { :popular => :get, :heaviest=>
:get }

With this I can still add the custom method to my widgets controller.
This approach makes the most sense to me considering how my application
is organized.