2
My route scheme needs to add 3 new routes to custom actions in my controller: start, Cancel and Finish.
resources :disputes do
scope module: :dispute, except: :index do
resources :conference, shallow: true, shallow_prefix: :dispute do
put :start
put :cancel
put :finish
end
end
end
The problem is that instead of using :id
is used :dispute_id
. To solve this I made the manual addition of each route:
resources :disputes do
scope module: :dispute, except: :index do
resources :conference, shallow: true, shallow_prefix: :dispute
end
end
# REVIEW: Existe uma melhor maneira para fazer isso?
put 'conference/:id/start', to: 'dispute/conference#start'
put 'conference/:id/cancel', to: 'dispute/conference#cancel'
put 'conference/:id/finish', to: 'dispute/conference#finish'
Which in fact did not look elegant. Now, it is possible to solve this without the need to manually write each put
?