Improvements in proposal controller

`if..else` is better than unless with return.
On failed update render `edit` template and not render `new` template.
On failed save redirect to index path and not render `new` template.
Change `destory` to `withdraw`, cause `destroy` makes DELETE request when
we are updating the event record.
Check for success for save in withdraw (save can fail for reasons other than validation).
This commit is contained in:
Aditya Prakash 2016-03-24 00:24:52 +05:30
parent 10ef898a0d
commit dcb98c49f9
3 changed files with 36 additions and 34 deletions

View file

@ -95,11 +95,12 @@ Osem::Application.routes.draw do
resources :conference, only: [:index, :show] do
resource :program, except: :destroy do
resources :proposal do
resources :proposal, except: :destroy do
get 'commercials/render_commercial' => 'commercials#render_commercial'
resources :commercials, only: [:create, :update, :destroy]
resources :event_attachment, controller: 'event_attachments'
member do
patch '/withdraw' => 'proposal#withdraw'
patch '/confirm' => 'proposal#confirm'
patch '/restart' => 'proposal#restart'
end