Class: ActsAsTable::Value

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/acts_as_table/value.rb

Overview

ActsAsTable value.

Instance Attribute Summary collapse

Belongs to collapse

Has many collapse

Instance Attribute Details

#positionInteger?

Returns the position of this ActsAsTable value or nil.

Returns:

  • (Integer, nil)


24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'app/models/acts_as_table/value.rb', line 24

class Value < ::ActiveRecord::Base
  # @!parse
  #   include ActsAsTable::ValueProvider
  #   include ActsAsTable::ValueProviderAssociationMethods

  self.table_name = ActsAsTable.values_table

  # Returns the ActsAsTable column model that provided this ActsAsTable value or `nil`.
  #
  # @return [ActsAsTable::ColumnModel, nil]
  belongs_to :column_model, **{
    class_name: 'ActsAsTable::ColumnModel',
    inverse_of: :values,
    required: false,
  }

  # Returns the ActsAsTable record for this ActsAsTable value.
  belongs_to :record, **{
    class_name: 'ActsAsTable::Record',
    counter_cache: 'values_count',
    inverse_of: :values,
    required: true,
  }

  # Returns the ActsAsTable value provider that provider the value for this ActsAsTable value.
  #
  # @return [ActsAsTable::ValueProvider::InstanceMethods]
  belongs_to :value_provider, **{
    polymorphic: true,
    required: true,
  }

  # Returns the ActsAsTable record errors for this ActsAsTable value.
  has_many :record_errors, -> { order(attribute_name: :asc, message: :asc) }, **{
    autosave: false,
    class_name: 'ActsAsTable::RecordError',
    dependent: :nullify,
    foreign_key: 'value_id',
    inverse_of: :value,
    validate: false,
  }

  validates :record_id, **{
    uniqueness: {
      scope: ['value_provider_id', 'value_provider_type'],
    },
  }

  # validates :position, **{}

  # validates :source_value, **{}

  # validates :target_value, **{}

  # validates :value_provider_changed, **{}
end

#record_errors_countInteger (readonly)

Returns the number of ActsAsTable record errors for this ActsAsTable value.

Returns:

  • (Integer)


24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'app/models/acts_as_table/value.rb', line 24

class Value < ::ActiveRecord::Base
  # @!parse
  #   include ActsAsTable::ValueProvider
  #   include ActsAsTable::ValueProviderAssociationMethods

  self.table_name = ActsAsTable.values_table

  # Returns the ActsAsTable column model that provided this ActsAsTable value or `nil`.
  #
  # @return [ActsAsTable::ColumnModel, nil]
  belongs_to :column_model, **{
    class_name: 'ActsAsTable::ColumnModel',
    inverse_of: :values,
    required: false,
  }

  # Returns the ActsAsTable record for this ActsAsTable value.
  belongs_to :record, **{
    class_name: 'ActsAsTable::Record',
    counter_cache: 'values_count',
    inverse_of: :values,
    required: true,
  }

  # Returns the ActsAsTable value provider that provider the value for this ActsAsTable value.
  #
  # @return [ActsAsTable::ValueProvider::InstanceMethods]
  belongs_to :value_provider, **{
    polymorphic: true,
    required: true,
  }

  # Returns the ActsAsTable record errors for this ActsAsTable value.
  has_many :record_errors, -> { order(attribute_name: :asc, message: :asc) }, **{
    autosave: false,
    class_name: 'ActsAsTable::RecordError',
    dependent: :nullify,
    foreign_key: 'value_id',
    inverse_of: :value,
    validate: false,
  }

  validates :record_id, **{
    uniqueness: {
      scope: ['value_provider_id', 'value_provider_type'],
    },
  }

  # validates :position, **{}

  # validates :source_value, **{}

  # validates :target_value, **{}

  # validates :value_provider_changed, **{}
end

#record_idObject (readonly)



66
67
68
69
70
# File 'app/models/acts_as_table/value.rb', line 66

validates :record_id, **{
  uniqueness: {
    scope: ['value_provider_id', 'value_provider_type'],
  },
}

#source_valueString?

Returns the source value for this ActsAsTable value.

Returns:

  • (String, nil)


24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'app/models/acts_as_table/value.rb', line 24

class Value < ::ActiveRecord::Base
  # @!parse
  #   include ActsAsTable::ValueProvider
  #   include ActsAsTable::ValueProviderAssociationMethods

  self.table_name = ActsAsTable.values_table

  # Returns the ActsAsTable column model that provided this ActsAsTable value or `nil`.
  #
  # @return [ActsAsTable::ColumnModel, nil]
  belongs_to :column_model, **{
    class_name: 'ActsAsTable::ColumnModel',
    inverse_of: :values,
    required: false,
  }

  # Returns the ActsAsTable record for this ActsAsTable value.
  belongs_to :record, **{
    class_name: 'ActsAsTable::Record',
    counter_cache: 'values_count',
    inverse_of: :values,
    required: true,
  }

  # Returns the ActsAsTable value provider that provider the value for this ActsAsTable value.
  #
  # @return [ActsAsTable::ValueProvider::InstanceMethods]
  belongs_to :value_provider, **{
    polymorphic: true,
    required: true,
  }

  # Returns the ActsAsTable record errors for this ActsAsTable value.
  has_many :record_errors, -> { order(attribute_name: :asc, message: :asc) }, **{
    autosave: false,
    class_name: 'ActsAsTable::RecordError',
    dependent: :nullify,
    foreign_key: 'value_id',
    inverse_of: :value,
    validate: false,
  }

  validates :record_id, **{
    uniqueness: {
      scope: ['value_provider_id', 'value_provider_type'],
    },
  }

  # validates :position, **{}

  # validates :source_value, **{}

  # validates :target_value, **{}

  # validates :value_provider_changed, **{}
end

#target_valueString?

Returns the target value for this ActsAsTable value.

Returns:

  • (String, nil)


24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'app/models/acts_as_table/value.rb', line 24

class Value < ::ActiveRecord::Base
  # @!parse
  #   include ActsAsTable::ValueProvider
  #   include ActsAsTable::ValueProviderAssociationMethods

  self.table_name = ActsAsTable.values_table

  # Returns the ActsAsTable column model that provided this ActsAsTable value or `nil`.
  #
  # @return [ActsAsTable::ColumnModel, nil]
  belongs_to :column_model, **{
    class_name: 'ActsAsTable::ColumnModel',
    inverse_of: :values,
    required: false,
  }

  # Returns the ActsAsTable record for this ActsAsTable value.
  belongs_to :record, **{
    class_name: 'ActsAsTable::Record',
    counter_cache: 'values_count',
    inverse_of: :values,
    required: true,
  }

  # Returns the ActsAsTable value provider that provider the value for this ActsAsTable value.
  #
  # @return [ActsAsTable::ValueProvider::InstanceMethods]
  belongs_to :value_provider, **{
    polymorphic: true,
    required: true,
  }

  # Returns the ActsAsTable record errors for this ActsAsTable value.
  has_many :record_errors, -> { order(attribute_name: :asc, message: :asc) }, **{
    autosave: false,
    class_name: 'ActsAsTable::RecordError',
    dependent: :nullify,
    foreign_key: 'value_id',
    inverse_of: :value,
    validate: false,
  }

  validates :record_id, **{
    uniqueness: {
      scope: ['value_provider_id', 'value_provider_type'],
    },
  }

  # validates :position, **{}

  # validates :source_value, **{}

  # validates :target_value, **{}

  # validates :value_provider_changed, **{}
end

#value_provider_changedBoolean

Returns true if the ActsAsTable value provider changed the value for this ActsAsTable value. Otherwise, returns false.

Returns:

  • (Boolean)


24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'app/models/acts_as_table/value.rb', line 24

class Value < ::ActiveRecord::Base
  # @!parse
  #   include ActsAsTable::ValueProvider
  #   include ActsAsTable::ValueProviderAssociationMethods

  self.table_name = ActsAsTable.values_table

  # Returns the ActsAsTable column model that provided this ActsAsTable value or `nil`.
  #
  # @return [ActsAsTable::ColumnModel, nil]
  belongs_to :column_model, **{
    class_name: 'ActsAsTable::ColumnModel',
    inverse_of: :values,
    required: false,
  }

  # Returns the ActsAsTable record for this ActsAsTable value.
  belongs_to :record, **{
    class_name: 'ActsAsTable::Record',
    counter_cache: 'values_count',
    inverse_of: :values,
    required: true,
  }

  # Returns the ActsAsTable value provider that provider the value for this ActsAsTable value.
  #
  # @return [ActsAsTable::ValueProvider::InstanceMethods]
  belongs_to :value_provider, **{
    polymorphic: true,
    required: true,
  }

  # Returns the ActsAsTable record errors for this ActsAsTable value.
  has_many :record_errors, -> { order(attribute_name: :asc, message: :asc) }, **{
    autosave: false,
    class_name: 'ActsAsTable::RecordError',
    dependent: :nullify,
    foreign_key: 'value_id',
    inverse_of: :value,
    validate: false,
  }

  validates :record_id, **{
    uniqueness: {
      scope: ['value_provider_id', 'value_provider_type'],
    },
  }

  # validates :position, **{}

  # validates :source_value, **{}

  # validates :target_value, **{}

  # validates :value_provider_changed, **{}
end

Instance Method Details

#column_modelActsAsTable::ColumnModel?

Returns the ActsAsTable column model that provided this ActsAsTable value or nil.

Returns:



34
35
36
37
38
# File 'app/models/acts_as_table/value.rb', line 34

belongs_to :column_model, **{
  class_name: 'ActsAsTable::ColumnModel',
  inverse_of: :values,
  required: false,
}

#recordActsAsTable::Record

Returns the ActsAsTable record for this ActsAsTable value.



41
42
43
44
45
46
# File 'app/models/acts_as_table/value.rb', line 41

belongs_to :record, **{
  class_name: 'ActsAsTable::Record',
  counter_cache: 'values_count',
  inverse_of: :values,
  required: true,
}

#record_errorsActiveRecord::Relation<ActsAsTable::RecordError>

Returns the ActsAsTable record errors for this ActsAsTable value.

Returns:

See Also:



57
58
59
60
61
62
63
64
# File 'app/models/acts_as_table/value.rb', line 57

has_many :record_errors, -> { order(attribute_name: :asc, message: :asc) }, **{
  autosave: false,
  class_name: 'ActsAsTable::RecordError',
  dependent: :nullify,
  foreign_key: 'value_id',
  inverse_of: :value,
  validate: false,
}

#value_providerActsAsTable::ValueProvider::InstanceMethods

Returns the ActsAsTable value provider that provider the value for this ActsAsTable value.



51
52
53
54
# File 'app/models/acts_as_table/value.rb', line 51

belongs_to :value_provider, **{
  polymorphic: true,
  required: true,
}