correction home page bad siret error

This commit is contained in:
Xavier J 2015-09-22 15:36:44 +02:00
parent 3898d8f88e
commit f7fb0f99bf
4 changed files with 15 additions and 8 deletions

View file

@ -27,7 +27,7 @@ class DossiersController < ApplicationController
redirect_to url_for(controller: :dossiers, action: :show, id: @dossier.id)
rescue RestClient::ResourceNotFound
redirect_to url_for(controller: :start, action: :error_siret)
redirect_to url_for(controller: :start, action: :error_siret, procedure_id: params['procedure_id'])
rescue ActiveRecord::RecordNotFound
redirect_to url_for(controller: :start, action: :error_dossier)
end

View file

@ -1,7 +1,6 @@
class StartController < ApplicationController
def index
@procedure_id = params['procedure_id']
@procedure = Procedure.find(@procedure_id)
get_procedure_infos
if @procedure.nil?
error_procedure
@ -15,6 +14,7 @@ class StartController < ApplicationController
end
def error_siret
get_procedure_infos
flash.now.alert = 'Ce SIRET n\'est pas valide'
render 'index'
end
@ -28,4 +28,10 @@ class StartController < ApplicationController
flash.now.alert = 'Ce dossier n\'existe pas'
render 'index'
end
private
def get_procedure_infos
@procedure = Procedure.find(params['procedure_id'])
end
end