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.
108 109 110 111 112 |
# File 'activerecord/lib/active_record/attribute_assignment.rb', line 108 def initialize(object, name, values) @object = object @name = name @values = values end |
Instance Attribute Details
#column ⇒ Object (readonly)
Returns the value of attribute column
106 107 108 |
# File 'activerecord/lib/active_record/attribute_assignment.rb', line 106 def column @column end |
#name ⇒ Object (readonly)
Returns the value of attribute name
106 107 108 |
# File 'activerecord/lib/active_record/attribute_assignment.rb', line 106 def name @name end |
#object ⇒ Object (readonly)
Returns the value of attribute object
106 107 108 |
# File 'activerecord/lib/active_record/attribute_assignment.rb', line 106 def object @object end |
#values ⇒ Object (readonly)
Returns the value of attribute values
106 107 108 |
# File 'activerecord/lib/active_record/attribute_assignment.rb', line 106 def values @values end |
Instance Method Details
#read_value ⇒ Object
114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'activerecord/lib/active_record/attribute_assignment.rb', line 114 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 |