]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5007 fix creation of manual rule in Rails code
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Fri, 13 Jun 2014 08:23:07 +0000 (10:23 +0200)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Fri, 13 Jun 2014 08:23:21 +0000 (10:23 +0200)
sonar-server/src/main/webapp/WEB-INF/app/models/rule.rb

index 55cfc0549a14558deac3056bad322c4397ac8fca..a5bd31ca65662f20c529c873ab85b766a03f15c4 100644 (file)
@@ -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