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.5.6 app/models/concerns/foreman_remote_execution/template_extensions.rb
foreman_remote_execution-1.6.3 app/models/concerns/foreman_remote_execution/template_extensions.rb
foreman_remote_execution-1.6.2 app/models/concerns/foreman_remote_execution/template_extensions.rb
foreman_remote_execution-1.5.5 app/models/concerns/foreman_remote_execution/template_extensions.rb
foreman_remote_execution-1.6.1 app/models/concerns/foreman_remote_execution/template_extensions.rb
foreman_remote_execution-1.6.0 app/models/concerns/foreman_remote_execution/template_extensions.rb
foreman_remote_execution-1.5.4 app/models/concerns/foreman_remote_execution/template_extensions.rb
foreman_remote_execution-1.5.3 app/models/concerns/foreman_remote_execution/template_extensions.rb
foreman_remote_execution-1.5.2 app/models/concerns/foreman_remote_execution/template_extensions.rb
foreman_remote_execution-1.5.1 app/models/concerns/foreman_remote_execution/template_extensions.rb
foreman_remote_execution-1.5.0 app/models/concerns/foreman_remote_execution/template_extensions.rb
foreman_remote_execution-1.4.6 app/models/concerns/foreman_remote_execution/template_extensions.rb
foreman_remote_execution-1.4.5 app/models/concerns/foreman_remote_execution/template_extensions.rb
foreman_remote_execution-1.4.4 app/models/concerns/foreman_remote_execution/template_extensions.rb
foreman_remote_execution-1.4.3 app/models/concerns/foreman_remote_execution/template_extensions.rb
foreman_remote_execution-1.4.2 app/models/concerns/foreman_remote_execution/template_extensions.rb
foreman_remote_execution-1.3.7 app/models/concerns/foreman_remote_execution/template_extensions.rb
foreman_remote_execution-1.3.6 app/models/concerns/foreman_remote_execution/template_extensions.rb
foreman_remote_execution-1.4.1 app/models/concerns/foreman_remote_execution/template_extensions.rb
foreman_remote_execution-1.3.5 app/models/concerns/foreman_remote_execution/template_extensions.rb