Hi Chris,

You can't do it using Rails' map.resources macro. You need to use the
router directly, like this:

map.posts '', :controller => 'posts', :action => 'index', :conditions
=> {:method => :get}
map.posts '', :controller => 'posts', :action => 'create', :conditions
=> {:method => :post}
map.new_post 'new', :controller => 'posts', :action =>
'new', :conditions => {:method => :get}
map.post ':id', :controller => 'posts', :action => 'show', :conditions
=> {:method => :get}
map.post ':id', :controller => 'posts', :action =>
'update', :conditions => {:method => :put}
map.post ':id', :controller => 'posts', :action =>
'destroy', :conditions => {:method => :delete}
map.edit_post ':id/edit', :controller => 'posts', :action =>
'edit', :conditions => {:method => :get}
map.resources :comments, :path_prefix => ':post_id'

it will work, but generally it's not a very good idea to have such
URLs, cause it won't work very well if you will have lots of resources
at some point. Maybe it will be better to use standard routes + 2
aliases, for index (/ — shows all posts) and for show (/123 - shows a
specific post).

Dmitry


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to