Commit ac1b5def authored by blackst0ne's avatar blackst0ne

[Rails5] Fix admin/application_settings_controller

The `RAILS5=1 rspec spec/controllers/admin/application_settings_controller_spec.rb`
command throws the error:

Failures:

  1) Admin::ApplicationSettingsController PUT #update falls back to defaults when settings are omitted
      Failure/Error: import_sources = params[:application_setting][:import_sources]

      NoMethodError:
        undefined method `[]' for nil:NilClass
      # ./app/controllers/admin/application_settings_controller.rb:62:in `application_setting_params'

This commit fixes it.
parent 6b246360
......@@ -56,7 +56,9 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
end
def application_setting_params
params[:application_setting] ||= {}
import_sources = params[:application_setting][:import_sources]
if import_sources.nil?
params[:application_setting][:import_sources] = []
else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment