]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-3529 Fixes
authorDavid Gageot <david@gageot.net>
Mon, 1 Oct 2012 07:38:20 +0000 (09:38 +0200)
committerDavid Gageot <david@gageot.net>
Mon, 1 Oct 2012 07:38:27 +0000 (09:38 +0200)
sonar-server/src/main/webapp/WEB-INF/app/controllers/settings_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/helpers/settings_helper.rb
sonar-server/src/main/webapp/WEB-INF/app/models/property.rb

index 696296616d7f2c3c1d8d5c2967019397643f32e3..f03ef2d40cb2638f15316da6a7795201932d2da0 100644 (file)
@@ -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
index 3281dce96f545172c1a17bf5a9e219e2bc04f032..d6eb4b4345adc9e87166cc0284907753cf25001a 100644 (file)
@@ -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
index 366cc3b9844411fbf3e15558a6fe04e85e530448..442a715db70697225d23543d375764c8bb43f1b4 100644 (file)
@@ -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