diff options
Diffstat (limited to 'app')
| -rw-r--r-- | app/models/compliance_control.rb | 5 | ||||
| -rw-r--r-- | app/models/generic_attribute_min_max.rb | 27 |
2 files changed, 31 insertions, 1 deletions
diff --git a/app/models/compliance_control.rb b/app/models/compliance_control.rb index 64556b524..12ff4737a 100644 --- a/app/models/compliance_control.rb +++ b/app/models/compliance_control.rb @@ -2,8 +2,11 @@ class ComplianceControl < ActiveRecord::Base belongs_to :compliance_control_set belongs_to :compliance_control_block - enum criticity: [:info, :warning, :error] + extend Enumerize + enumerize :criticity, in: %i(info warning error), scope: true, default: :info + validates :criticity, presence: true validates :name, presence: true validates :code, presence: true + validates :compliance_control_set, presence: true end diff --git a/app/models/generic_attribute_min_max.rb b/app/models/generic_attribute_min_max.rb new file mode 100644 index 000000000..e9a127c56 --- /dev/null +++ b/app/models/generic_attribute_min_max.rb @@ -0,0 +1,27 @@ +#module ComplianceControls + + class GenericAttributeMinMax < ComplianceControl + + + hstore_accessor :control_attributes, minimum: :integer, maximum: :integer + #attribute :minimum, type: :integer, optionnal: true + #attribute :maximum, type: :integer, optionnal: true + # #attribute :target, type: ModelAttribute + + @@default_criticity = :warning + @@default_code = "3-Generic-2" + + validate :min_max_values + def min_max_values + true + end + + after_initialize do + self.name = 'GenericAttributeMinMax' + self.code = @@default_code + self.criticity = @@default_criticity + end + + end + +#end |
