aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2012-10-12 16:50:01 +0200
committerSimon Brandhof <simon.brandhof@gmail.com>2012-10-12 16:50:01 +0200
commitb0f5591e3d4cb08834ad7c50a253e0da57aab3db (patch)
tree3509bbceb7dbec2383a741b66bbfeb8ff067c5f8
parent6ccbe69b085eadfc18598a9ff87b9d3c360480dc (diff)
downloadsonarqube-b0f5591e3d4cb08834ad7c50a253e0da57aab3db.tar.gz
sonarqube-b0f5591e3d4cb08834ad7c50a253e0da57aab3db.zip
Fix profile names with single quote
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/models/profile.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/profile.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/profile.rb
index c4197f87fb6..ca469daa5e0 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/models/profile.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/models/profile.rb
@@ -24,9 +24,6 @@ class Profile < ActiveRecord::Base
has_many :active_rules, :class_name => 'ActiveRule', :foreign_key => 'profile_id', :dependent => :destroy, :include => ['rule']
has_many :active_rules_with_params, :class_name => 'ActiveRule', :foreign_key => 'profile_id', :include => ['active_rule_parameters', 'active_rule_note']
has_many :changes, :class_name => 'ActiveRuleChange', :dependent => :destroy
- has_many :children, :class_name => 'Profile', :finder_sql => %q(
- select c.* from rules_profiles c where c.parent_name='#{name}' and c.language='#{language}'
- )
validates_uniqueness_of :name, :scope => :language, :case_sensitive => false, :message => Api::Utils.message('quality_profiles.already_exists')
validates_presence_of :name, :message => Api::Utils.message('quality_profiles.please_type_profile_name')
@@ -121,6 +118,13 @@ class Profile < ActiveRecord::Base
end
end
+ def children
+ @children ||=
+ begin
+ Profile.find(:all, :conditions => ['parent_name=? and language=?', name, language])
+ end
+ end
+
def count_active_rules
active_rules.select { |ar| ar.rule.enabled }.size
end