Adding custom routes to a restful app

i’ve done a few project using restful routing but now i need to add an
action that isn’t part of one of the main crud methods.

i added this to my routes.rb file:

map.resources :works, :collection => { :featured => :get }

and have a “featured” action in the works controller. but for some
reason everytime i try to go to http://localhost:3000/works/featured,
i get an unknown action error. looking at the log file, it’s trying to
find this page:

Parameters: {“action”=>“show”, “id”=>“featured”,
“controller”=>“works”}

is there something i did wrong or something i missed in order to make
this work?

thanks.

You would have to use the URL:

http://localhost:3000/works;featured

thanks. yeah i was just trying to access the url wrong.

map.feature ‘works/featured’, :controller => ‘works’, :action =>
‘featured’

then user feature_url or feature_path to get at a link to it. I hope
this gets you where you need to be headed.

Amos

On 9/16/07, Josh [email protected] wrote:

i get an unknown action error. looking at the log file, it’s trying to


Amos K.
A. King Software Development and Consulting, L.C.
http://dirtyInformation.com

Looking for something to do? Visit http://ImThere.com