From: David Gageot Date: Mon, 1 Oct 2012 07:38:20 +0000 (+0200) Subject: SONAR-3529 Fixes X-Git-Tag: 3.3~163 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=523279b2287c4699605c570d096edd07bd3394ee;p=sonarqube.git SONAR-3529 Fixes --- diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/settings_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/settings_controller.rb index 696296616d7..f03ef2d40cb 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/settings_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/settings_controller.rb @@ -48,7 +48,7 @@ class SettingsController < ApplicationController # TODO: Validation def save_property_sets(resource_id) - params[:property_sets].each do |key, value| + (params[:property_sets] || []).each do |key, value| set_keys = drop_trailing_blank_values(value) Property.with_key_prefix(key + '.').delete_all @@ -65,7 +65,13 @@ class SettingsController < ApplicationController def save_properties(resource_id) @updated_properties = {} - params[:settings].each do |key, value| + + puts params[:settings] + puts params[:settings].keys + + + (params[:settings] || []).each do |key, value| + puts value if value.kind_of? Array value = drop_trailing_blank_values(value) end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/helpers/settings_helper.rb b/sonar-server/src/main/webapp/WEB-INF/app/helpers/settings_helper.rb index 3281dce96f5..d6eb4b4345a 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/helpers/settings_helper.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/helpers/settings_helper.rb @@ -60,6 +60,6 @@ module SettingsHelper end def input_name(property) - "settings[#{h property.key}#{property.multi_values ? '[]' : ''}]" + "settings[#{h property.key}]" + (property.multi_values ? '[]' : '') end end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/property.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/property.rb index 366cc3b9844..442a715db70 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/property.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/property.rb @@ -93,7 +93,8 @@ class Property < ActiveRecord::Base value = value.first end - text_value = (value.blank? ? nil : value.to_s) + value = value.to_s if value + text_value = (value.blank? ? nil : value) prop = by_key(key, resource_id, user_id) if prop