Fix feature: Enterprises list is shortened when error in bulk update

This commit is contained in:
Rohan Mitchell
2015-02-18 15:32:23 +11:00
parent 224864a8d8
commit f83ceae5d1

View File

@@ -49,6 +49,8 @@ module Admin
flash[:success] = 'Enterprises updated successfully'
redirect_to main_app.admin_enterprises_path
else
touched_ids = params[:enterprise_set][:collection_attributes].values.map { |v| v[:id].to_i }
@enterprise_set.collection.select! { |e| touched_ids.include? e.id }
flash[:error] = 'Update failed'
render :index
end