From 83f4f4f65c561353976a9839c2be38b37c49bfaa Mon Sep 17 00:00:00 2001 From: Bertocq Date: Wed, 11 Apr 2018 17:19:03 +0200 Subject: [PATCH] Remove unnecesary parameter at Investment to_csv If there's only one usage of `to_csv` and the parameter has always the same value... there's no good reason to bother using an additional argument. --- app/controllers/admin/budget_investments_controller.rb | 2 +- app/models/budget/investment.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/admin/budget_investments_controller.rb b/app/controllers/admin/budget_investments_controller.rb index bc4c8d49b..c85cbd98f 100644 --- a/app/controllers/admin/budget_investments_controller.rb +++ b/app/controllers/admin/budget_investments_controller.rb @@ -20,7 +20,7 @@ class Admin::BudgetInvestmentsController < Admin::BaseController format.html format.js format.csv do - send_data Budget::Investment.to_csv(@investments, headers: true), + send_data Budget::Investment.to_csv(@investments), filename: 'budget_investments.csv' end end diff --git a/app/models/budget/investment.rb b/app/models/budget/investment.rb index 6c96578c0..24d038d14 100644 --- a/app/models/budget/investment.rb +++ b/app/models/budget/investment.rb @@ -328,7 +328,7 @@ class Budget self.valuator_groups.collect(&:name).compact.join(', ').presence end - def self.to_csv(investments, options = {}) + def self.to_csv(investments) attrs = [I18n.t("admin.budget_investments.index.table_id"), I18n.t("admin.budget_investments.index.table_title"), I18n.t("admin.budget_investments.index.table_supports"), @@ -339,7 +339,7 @@ class Budget I18n.t("admin.budget_investments.index.table_feasibility"), I18n.t("admin.budget_investments.index.table_valuation_finished"), I18n.t("admin.budget_investments.index.table_selection")] - csv_string = CSV.generate(options) do |csv| + csv_string = CSV.generate(headers: true) do |csv| csv << attrs investments.each do |investment| id = investment.id.to_s