Class: Control
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Control
- Includes:
- AuthoredModel, FrequentModel, SearchableModel, SluggedModel
- Defined in:
- app/models/control.rb
Overview
A company control
Defined Under Namespace
Classes: ControlCycle
Class Method Summary (collapse)
-
+ (Object) all_non_company
All non-company section controls.
-
+ (Object) for_system(s)
All controls that may be attached to a system (must be company control).
Instance Method Summary (collapse)
-
- (Object) biz_process_ids
IDs of related Biz Processes (used by many2many widget).
- - (Object) display_name
-
- (Object) evidence_descriptor_ids
IDs of related evidence descriptors (used by many2many widget).
-
- (Object) implemented_section_ids
IDs of related Sections (used by many2many widget).
- - (Object) system_controls_for_cycle(cycle)
- - (Object) system_ids
Class Method Details
+ (Object) all_non_company
All non-company section controls
56 57 58 59 60 |
# File 'app/models/control.rb', line 56 def self.all_non_company joins(:section). where(:sections => { :company => false }). order(:slug) end |
+ (Object) for_system(s)
All controls that may be attached to a system (must be company control)
64 65 66 |
# File 'app/models/control.rb', line 64 def self.for_system(s) all end |
Instance Method Details
- (Object) biz_process_ids
IDs of related Biz Processes (used by many2many widget)
77 78 79 |
# File 'app/models/control.rb', line 77 def biz_process_ids biz_processes.map { |bp| bp.id } end |
- (Object) display_name
68 69 70 |
# File 'app/models/control.rb', line 68 def display_name "#{slug} - #{title}" end |
- (Object) evidence_descriptor_ids
IDs of related evidence descriptors (used by many2many widget)
87 88 89 |
# File 'app/models/control.rb', line 87 def evidence_descriptor_ids evidence_descriptors.map { |e| e.id } end |
- (Object) implemented_section_ids
IDs of related Sections (used by many2many widget)
82 83 84 |
# File 'app/models/control.rb', line 82 def implemented_section_ids sections.map { |c| c.id } end |
- (Object) system_controls_for_cycle(cycle)
108 109 110 111 112 |
# File 'app/models/control.rb', line 108 def system_controls_for_cycle(cycle) scs = system_controls scs = scs.where(:cycle_id => cycle.id) if cycle ControlCycle.new(scs) end |
- (Object) system_ids
72 73 74 |
# File 'app/models/control.rb', line 72 def system_ids systems.map { |s| s.id } end |