Class: Preloaders::RunnerManagerPolicyPreloader
- Inherits:
-
Object
- Object
- Preloaders::RunnerManagerPolicyPreloader
- Defined in:
- app/models/preloaders/runner_manager_policy_preloader.rb
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(runner_managers, current_user) ⇒ RunnerManagerPolicyPreloader
constructor
A new instance of RunnerManagerPolicyPreloader.
Constructor Details
#initialize(runner_managers, current_user) ⇒ RunnerManagerPolicyPreloader
Returns a new instance of RunnerManagerPolicyPreloader.
5 6 7 8 |
# File 'app/models/preloaders/runner_manager_policy_preloader.rb', line 5 def initialize(runner_managers, current_user) @runner_managers = runner_managers @current_user = current_user end |
Instance Method Details
#execute ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'app/models/preloaders/runner_manager_policy_preloader.rb', line 10 def execute return if runner_managers.is_a?(ActiveRecord::Relation) && runner_managers.null_relation? ActiveRecord::Associations::Preloader.new( records: runner_managers, associations: [:runner] ).call end |