method

default_attribute

Importance_0
v6.1.3.1 - Show latest stable - 0 notes - Class: LazyAttributeSet
default_attribute( name, value_present = true, value = values.fetch(name) { value_present = false } ) 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 73
      def default_attribute(
        name,
        value_present = true,
        value = values.fetch(name) { value_present = false }
      )
        type = additional_types.fetch(name, types[name])

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