method

assign_default_value

Importance_0
v5.2.3 - Show latest stable - 0 notes - Class: LazyAttributeHash
assign_default_value(name) private

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activemodel/lib/active_model/attribute_set/builder.rb, line 109
      def assign_default_value(name)
        type = additional_types.fetch(name, types[name])
        value_present = true
        value = values.fetch(name) { value_present = false }

        if value_present
          delegate_hash[name] = Attribute.from_database(name, value, type)
        elsif types.key?(name)
          attr = default_attributes[name]
          if attr
            delegate_hash[name] = attr.dup
          else
            delegate_hash[name] = Attribute.uninitialized(name, type)
          end
        end
      end
Register or log in to add new notes.