You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently MapRewire returns both the original map and the new map. This means we need to create boilerplate to be able to use MapRewire in a pipeline:
def changeset(variant, params) do
variant
|> normalize_data()
|> cast(
params,
~w(shopify_id title price weight compare_at_price requires_shipping sku available image_id option1 option2 option3)
)
end
defp normalize_data(data) do
[_old, new] = data <~> @transforms
new
end
To reduce the amount of boilerplate needed to use MapRewire we should consider creating a normalize_data function that can be used in a typical changeset:
def changeset(variant, params) do
variant
|> normalize_data(params, @transforms)
|> cast(
params,
~w(shopify_id title price weight compare_at_price requires_shipping sku available image_id option1 option2 option3)
)
end
The text was updated successfully, but these errors were encountered:
Currently MapRewire returns both the original map and the new map. This means we need to create boilerplate to be able to use MapRewire in a pipeline:
To reduce the amount of boilerplate needed to use MapRewire we should consider creating a
normalize_data
function that can be used in a typical changeset:The text was updated successfully, but these errors were encountered: