[fix #728] Reduce flash error size to avoid cookies overflow

This commit is contained in:
Simon Lehericey 2017-10-11 17:32:45 +02:00
parent dbdb6639f3
commit 6f4ddb9e3e
3 changed files with 10 additions and 4 deletions

View file

@ -100,7 +100,13 @@ class Users::DescriptionController < UsersController
private
def redirect_to_description_with_errors(dossier, errors)
flash.alert = errors
errors_to_display = if errors.count > 3
errors.take(3) + ['...']
else
errors
end
flash.alert = errors_to_display
redirect_to users_dossier_description_path(dossier_id: dossier.id)
end