REST and extra actions

Hi,

I'm trying to implement some charts in my REST application. But I
can't seem to use an extra action like "chart" in my controller.
Becouse of the rest approach, it sees the action name as an id.

Does anyone know how to overcome this? So that I can visit the charts
page of a sertain resource like /resource/charts ?

I know I could create a new controller and not adding it to the
resources in the routes file, but I would like to have the carts in
the resource controller, becouse in my opinion, the carts view belongs
to the resource.

Thank you in advance.

The first option is to make a completely new controller for charts. The index action would list all available charts and the show action lists the specific chart. That is the most RESTful approach

Another option would be to modify the show action so that it shows the chart.

/foo/1.png => displays the chart

Finally, if you absolutely must, you can use a :member action

map.resource :foos, :member => {:chart => :get}

/foos/1/chart

or map.resource :foos, :collection => {:charts => :get}

/foos/charts

A “collection” is like a list view - dealing with multiple objects
A “member” is for dealing with a specific object.