开发者

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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜