Sha256: f692af45c636ba10db0f78124f3c5828d756107423d9bea4b9dbdb3b58f7d679

Contents?: true

Size: 995 Bytes

Versions: 30

Compression:

Stored size: 995 Bytes

Contents

module ForemanRemoteExecution
  module TemplateExtensions
    extend ActiveSupport::Concern

    included do
      # autosave => true is required so the changes of inputs are saved even if template was not changed
      has_many :template_inputs, :dependent => :destroy, :foreign_key => 'template_id', :autosave => true
      has_many :foreign_input_sets, :dependent => :destroy, :foreign_key => 'template_id', :autosave => true

      def template_inputs_with_foreign(templates_stack = [])
        self.template_inputs.to_a + foreign_input_sets.map { |set| set.inputs(templates_stack) }.flatten
      end
      accepts_nested_attributes_for :template_inputs, :allow_destroy => true
      accepts_nested_attributes_for :foreign_input_sets, :allow_destroy => true
    end

    # create or overwrite instance methods...
    # def instance_method_name
    # end

    # module ClassMethods
    #   # create or overwrite class methods...
    #   def class_method_name
    #   end
    # end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
foreman_remote_execution-1.3.4 app/models/concerns/foreman_remote_execution/template_extensions.rb
foreman_remote_execution-1.3.3 app/models/concerns/foreman_remote_execution/template_extensions.rb
foreman_remote_execution-1.3.2 app/models/concerns/foreman_remote_execution/template_extensions.rb
foreman_remote_execution-1.3.1 app/models/concerns/foreman_remote_execution/template_extensions.rb
foreman_remote_execution-1.3.0 app/models/concerns/foreman_remote_execution/template_extensions.rb
foreman_remote_execution-1.2.2 app/models/concerns/foreman_remote_execution/template_extensions.rb
foreman_remote_execution-1.2.1 app/models/concerns/foreman_remote_execution/template_extensions.rb
foreman_remote_execution-1.2.0 app/models/concerns/foreman_remote_execution/template_extensions.rb
foreman_remote_execution-1.1.1 app/models/concerns/foreman_remote_execution/template_extensions.rb
foreman_remote_execution-1.1.0 app/models/concerns/foreman_remote_execution/template_extensions.rb