Files
openfoodnetwork/app/controllers/admin/invoice_settings_controller.rb
Maikel Linke 5b94049620 Whitelist params for several settings for Rails 5
Rails 5 is a bit stricter and Spree's Config#set method doesn't work
with a Parameters object.
2021-02-19 14:20:15 +11:00

24 lines
484 B
Ruby

module Admin
class InvoiceSettingsController < Spree::Admin::BaseController
def update
Spree::Config.set(preferences_params.to_h)
respond_to do |format|
format.html {
redirect_to main_app.edit_admin_invoice_settings_path
}
end
end
private
def preferences_params
params.require(:preferences).permit(
:enable_invoices?,
:invoice_style2?,
:enable_receipt_printing?,
)
end
end
end