Sorting in REST

I have written the following code for sorting list of courses:

<%= link_to_remote "From Date", :update => 'content', :url => {:controller=> "courses", :action => 'list', :sort => 'from_date' }, :before => "Element.show('loading')", :complete => "Element.hide('loading')", :method => 'get' %>

I want to change above code to REST architecture, I changed the url to courses_path, :sort =>'from_date. Its not working.

Can u help me to make it in RESTful way.

<%= link_to_remote "From Date", :update => 'content', :url => courses_path(:sort => 'from_date'), :method => :get, :before => "Element.show('loading'), :complete => "Element.hide('loading')" %>

in controller, change the 'list' action to be 'index'. List is not used by the REST defaults

def index     @courses.find(:all, :order => params[:sort]) end

in your routes make sure you have

map.resources :courses

Don't forget your checking when bringing in the params[:sort] parameter

If you need custom routes for your REST app do this, but think about the requirement first (it's not a bad thing to do when you need it, but often you don't need it):

map.resources :courses, :collection = {:list_tagged => :get}, :member => {:enable => :put}

etc. Collection takes the pluralised controller name plus the method you define, e.g. courses_search_path = '/courses/search' member takes the controller, plus a record selected by id, e.g. course_enable_path(@course) = /courses/1/enable