aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/compliance_control_set.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/compliance_control_set.rb')
-rw-r--r--app/models/compliance_control_set.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/app/models/compliance_control_set.rb b/app/models/compliance_control_set.rb
index cefdfbf1f..deb46f5a1 100644
--- a/app/models/compliance_control_set.rb
+++ b/app/models/compliance_control_set.rb
@@ -1,7 +1,12 @@
class ComplianceControlSet < ActiveRecord::Base
belongs_to :organisation
- has_many :compliance_controls
+ has_many :compliance_control_blocks, dependent: :destroy
+ has_many :compliance_controls, dependent: :destroy
validates :name, presence: true
+ validates :organisation, presence: true
+ scope :where_updated_at_between, ->(period_range) do
+ where('updated_at BETWEEN :begin AND :end', begin: period_range.begin, end: period_range.end)
+ end
end