Sha256: 11832f58c18d8915002faa298bede23940c0c777c3b2679d930a69d3a08533ea

Contents?: true

Size: 660 Bytes

Versions: 124

Compression:

Stored size: 660 Bytes

Contents

class TemplateInvocationInputValue < ApplicationRecord

  belongs_to :template_invocation
  belongs_to :template_input

  validates :value, :presence => true, :if => proc { |v| v.template_input.required? || v.value.nil? }

  validates :value, :inclusion => { :in => proc { |v| options_for_template_input v.template_input } },
                    :if => proc { |v| v.template_input.input_type == 'user' && v.template_input.options_array.present? }

  class << self

    private

    def options_for_template_input(template_input)
      options = template_input.options_array
      options += [''] unless template_input.required?
      options
    end
  end
end

Version data entries

124 entries across 124 versions & 1 rubygems

Version Path
foreman_remote_execution-4.2.3 app/models/template_invocation_input_value.rb
foreman_remote_execution-4.2.2 app/models/template_invocation_input_value.rb
foreman_remote_execution-4.2.1 app/models/template_invocation_input_value.rb
foreman_remote_execution-4.2.0 app/models/template_invocation_input_value.rb
foreman_remote_execution-4.1.0 app/models/template_invocation_input_value.rb
foreman_remote_execution-3.3.7 app/models/template_invocation_input_value.rb
foreman_remote_execution-4.0.0 app/models/template_invocation_input_value.rb
foreman_remote_execution-3.3.6 app/models/template_invocation_input_value.rb
foreman_remote_execution-3.3.5 app/models/template_invocation_input_value.rb
foreman_remote_execution-3.3.4 app/models/template_invocation_input_value.rb
foreman_remote_execution-3.3.3 app/models/template_invocation_input_value.rb
foreman_remote_execution-3.2.2 app/models/template_invocation_input_value.rb
foreman_remote_execution-3.3.2 app/models/template_invocation_input_value.rb
foreman_remote_execution-3.3.1 app/models/template_invocation_input_value.rb
foreman_remote_execution-3.3.0 app/models/template_invocation_input_value.rb
foreman_remote_execution-3.2.1 app/models/template_invocation_input_value.rb
foreman_remote_execution-3.2.0 app/models/template_invocation_input_value.rb
foreman_remote_execution-3.1.0 app/models/template_invocation_input_value.rb
foreman_remote_execution-2.0.10 app/models/template_invocation_input_value.rb
foreman_remote_execution-2.0.9 app/models/template_invocation_input_value.rb