diff --git a/app/controllers/product_drives_controller.rb b/app/controllers/product_drives_controller.rb index 874957378f..a334351f02 100644 --- a/app/controllers/product_drives_controller.rb +++ b/app/controllers/product_drives_controller.rb @@ -15,7 +15,9 @@ def index @paginated_product_drives = @product_drives.page(params[:page]) # to be used in the name filter to sort product drives in alpha order - @product_drives_alphabetical = @product_drives.sort_by { |pd| pd.name.downcase } + @product_drives_alphabetical = @product_drives.to_a.sort_by do |pd| + pd.name.downcase.split(/(\d+)/).map { |chunk| chunk.match?(/^\d+$/) ? chunk.to_i : chunk } + end @item_categories = current_organization.item_categories @selected_name_filter = filter_params[:by_name] @selected_item_category = filter_params[:by_item_category_id]