Load attribute's default_value in hub when no existing value exists #1310
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request makes use of the the
default_value
property of Attributes in the hub.Currently, if an Attribute has a
default_value
set, when that Attribute is linked to a Model and displayed in the hub, the field displayed for that Attribute is blank on create and when no pre-existing value exists.For example, if I have an Attribute Group called "Foo" that contains an Attribute call "Bar" that is an Attribute of type "Number" with a default value of 42, I will see the following on the Product Creation page (when that Attribute is linked to my Product Type):
With this pull request, when an Attribute has a
default_value
set, that value will be loaded into the field in the Hub. When applied to the previous example, this will now display thedefault_value
(42, in this case) in the field: