From: Simon Brandhof Date: Fri, 13 Jun 2014 08:23:07 +0000 (+0200) Subject: SONAR-5007 fix creation of manual rule in Rails code X-Git-Tag: 4.4-RC1~446 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=5d8323e9d2ba0d6ec84caa40d62e3b79763c05df;p=sonarqube.git SONAR-5007 fix creation of manual rule in Rails code --- diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/rule.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/rule.rb index 55cfc0549a1..a5bd31ca656 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/rule.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/rule.rb @@ -37,16 +37,6 @@ class Rule < ActiveRecord::Base has_many :active_rules, :inverse_of => :rule belongs_to :parent, :class_name => 'Rule', :foreign_key => 'parent_id' -=begin TODO Uncomment these lines to make rule read-only when Rule facade is complete - def read_only? - true - end - - def before_destroy - raise ActiveRecord::ReadOnlyRecord - end -=end - def repository_key plugin_name end @@ -72,7 +62,7 @@ class Rule < ActiveRecord::Base end def template? - cardinality=='MULTIPLE' + is_template end def ready? @@ -182,6 +172,7 @@ class Rule < ActiveRecord::Base :description => options[:description], :plugin_rule_key => key, :status => STATUS_READY, + :is_template => false, :plugin_name => MANUAL_REPOSITORY_KEY} Rule.create!(creation_options) end