Class: ActiveRecord::AttributeAssignment::MultiparameterAttribute
- Defined in:
- activerecord/lib/active_record/attribute_assignment.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#column ⇒ Object
readonly
Returns the value of attribute column.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#object ⇒ Object
readonly
Returns the value of attribute object.
-
#values ⇒ Object
readonly
Returns the value of attribute values.
Instance Method Summary collapse
-
#initialize(object, name, values) ⇒ MultiparameterAttribute
constructor
A new instance of MultiparameterAttribute.
- #read_value ⇒ Object
Constructor Details
#initialize(object, name, values) ⇒ MultiparameterAttribute
Returns a new instance of MultiparameterAttribute.
111 112 113 114 115 |
# File 'activerecord/lib/active_record/attribute_assignment.rb', line 111 def initialize(object, name, values) @object = object @name = name @values = values end |
Instance Attribute Details
#column ⇒ Object (readonly)
Returns the value of attribute column
109 110 111 |
# File 'activerecord/lib/active_record/attribute_assignment.rb', line 109 def column @column end |
#name ⇒ Object (readonly)
Returns the value of attribute name
109 110 111 |
# File 'activerecord/lib/active_record/attribute_assignment.rb', line 109 def name @name end |
#object ⇒ Object (readonly)
Returns the value of attribute object
109 110 111 |
# File 'activerecord/lib/active_record/attribute_assignment.rb', line 109 def object @object end |
#values ⇒ Object (readonly)
Returns the value of attribute values
109 110 111 |
# File 'activerecord/lib/active_record/attribute_assignment.rb', line 109 def values @values end |
Instance Method Details
#read_value ⇒ Object
117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'activerecord/lib/active_record/attribute_assignment.rb', line 117 def read_value return if values.values.compact.empty? @column = object.class.reflect_on_aggregation(name.to_sym) || object.column_for_attribute(name) klass = column.klass if klass == Time read_time elsif klass == Date read_date else read_other(klass) end end |