Adding Custom Route to Rails app

前端 未结 2 963
不知归路
不知归路 2021-02-02 00:55

I have read up on the Rails Guides.

What I want to set up are the following routes that are routed to the \'profiles\' controller:

GET profiles/charities

2条回答
  •  既然无缘
    2021-02-02 01:37

    The charities and donors seem to be nested resources. If so, in your config/routes.rb file you should have something like,

    resources :profiles do
      resources :charities
      resources :donors
    end
    

    Because these are nested resources, you do not need the two methods named charities and donors in your profiles controller. In fact, depending on your app, you may need separate controllers and/or models for your charities and donors.

提交回复
热议问题