My route schema 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
, :dispute_id
is used. To resolve this, I manually added 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'
What did not really look stylish. Now, is it possible to resolve this without the need to manually write each put
?