0

I'm using Wicked to build an object in steps, and would like to clean up my routes a little bit.

Currently, my router looks like this:

resources :surveys, only: [:new, :create], path: 'feedback' do
  resources :steps, only: [:show, :update],  controller: 'survey/steps'
end

So my routes end up being:

GET '/feedback/new' => 'surveys#new'
POST '/feedback/create' => 'surveys#create'
GET '/feedback/:id/steps/step1' => 'survey/steps#show'
PUT '/feedback/:id/steps/step1' => 'survey/steps#update'

Ideally, I'd like to remove both the survey id and the 'steps' name from my routes, so that they look like this:

GET /feedback => 'surveys#new'
POST /feedback => 'surveys#create'
GET /feedback/step1 => 'survey/steps#show'
PUT /feedback/step1 => 'survey/steps#update'
...

Any simple way to do this?

djfdev
  • 5,747
  • 3
  • 19
  • 38

1 Answers1

0

resource :steps #as singular

resources :surveys, only: [:new, :create], path: 'feedback' do
  resource :steps, only: [:show, :update],  controller: 'survey/steps'
end
Breno Perucchi
  • 873
  • 7
  • 16