Nested Resource Routing
resources :patients do
collection do
get 'new_import'
post 'import'
end
How can I have the following urls?
/patients/import (GET) -->ACTION: new_import
/patients/import (POST) --> ACTION: import
Right NOW THE URLS ARE:
/patients/new_import (GET) -->ACTION: ne开发者_StackOverflow社区w_import
/patients/import (POST) --> ACTION: import
I must be able to do this WITHOUT doing:
match 'patients/import' => 'patients#new_import', :via => :get
match 'patients/import' => 'patients#import', :via => :post
resources :patients do collection do get 'import' => :new_import post 'import' => :import end end
Like you've written on top:
resources :patients do
collection do
get 'new_import'
post 'import'
end
end
Do you have any errors while trying to access this urls?
精彩评论