Sha256: ba27dfbca76882b663805025a6333a867b522b1a4cd4b458e8cc1980058b14be

Contents?: true

Size: 478 Bytes

Versions: 8

Compression:

Stored size: 478 Bytes

Contents

# coding: utf-8
class Formily::InputValue < ActiveRecord::Base

  self.table_name = 'formily_input_values'

  has_paper_trail

  belongs_to :input
  has_many :attach, foreign_key: :input_value_id, class_name: 'Formily::File'

  def get_value
    if self.attach.blank?
      if self.input.inputs.blank?
        self.input_value
      else
        self.input.inputs.map{|i| i.data.input_value.get_value}.join(', ')
      end
    else
      self.attach.file.url
    end
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
formily-0.0.5.6.5 app/models/formily/input_value.rb
formily-0.0.5.6.4 app/models/formily/input_value.rb
formily-0.0.5.6.3 app/models/formily/input_value.rb
formily-0.0.5.6.2 app/models/formily/input_value.rb
formily-0.0.5.6.1 app/models/formily/input_value.rb
formily-0.0.5.6.0 app/models/formily/input_value.rb
formily-0.0.5.5.9 app/models/formily/input_value.rb
formily-0.0.5.5.7 app/models/formily/input_value.rb