diff options
| author | Robert | 2017-10-27 08:31:36 +0200 |
|---|---|---|
| committer | Robert | 2017-10-31 19:11:05 +0100 |
| commit | 148d05e5c7db7861c167a97d67a6b6da5ea5d9e7 (patch) | |
| tree | 3229769556f238f08caec1572b678bca79d2f8ad /app/models/compliance_control.rb | |
| parent | e078a86f2bd642d5500044a255df75df8251ad9f (diff) | |
| download | chouette-core-148d05e5c7db7861c167a97d67a6b6da5ea5d9e7.tar.bz2 | |
Refs: #4774@3h;
Ransack filter view implemented
Diffstat (limited to 'app/models/compliance_control.rb')
| -rw-r--r-- | app/models/compliance_control.rb | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/app/models/compliance_control.rb b/app/models/compliance_control.rb index 08efa7e9a..e00a2c109 100644 --- a/app/models/compliance_control.rb +++ b/app/models/compliance_control.rb @@ -1,9 +1,31 @@ class ComplianceControl < ActiveRecord::Base + + class << self + def criticities; %i(warning error) end + def default_code; "" end + def dynamic_attributes + hstore_metadata_for_control_attributes.keys + end + + def policy_class + ComplianceControlPolicy + end + + def inherited(child) + child.instance_eval do + def model_name + ComplianceControl.model_name + end + end + super + end + end + extend Enumerize belongs_to :compliance_control_set belongs_to :compliance_control_block - enumerize :criticity, in: %i(warning error), scope: true, default: :warning + enumerize :criticity, in: criticities, scope: true, default: :warning hstore_accessor :control_attributes, {} validates :criticity, presence: true @@ -23,25 +45,6 @@ class ComplianceControl < ActiveRecord::Base direct_set_name: names.last)) end - class << self - def default_code; "" end - def dynamic_attributes - hstore_metadata_for_control_attributes.keys - end - - def policy_class - ComplianceControlPolicy - end - - def inherited(child) - child.instance_eval do - def model_name - ComplianceControl.model_name - end - end - super - end - end def initialize(attributes = {}) super |
