diff --git a/docs/3.0/fields/boolean_group.md b/docs/3.0/fields/boolean_group.md index a7bcae8e..8d97f4be 100644 --- a/docs/3.0/fields/boolean_group.md +++ b/docs/3.0/fields/boolean_group.md @@ -40,7 +40,7 @@ You may want to compute the values on the fly for your `BooleanGroup` field. You class Avo::Resources::Project < Avo::BaseResource field :features, as: :boolean_group, - options: -> do + options: -do record.features.each_with_object({}) do |feature, hash| hash[feature.id] = feature.name.humanize end @@ -63,23 +63,36 @@ The output value must be a hash as described above. } ``` +Before version 3.7.0 Avo would override the whole attribute with only the payload sent from the client. -:::warning -The final value in the database column will be overwritten, The options will not be appended. +```json +// Before update. +{ + "feature_enabled": true, + "another_feature_enabled": false, + "something_else": "some_value" // this will disappear +} +// After update. +{ + "feature_enabled": true, + "another_feature_enabled": false, +} +``` +Version 3.7.0 and up will only update the keys that you send from the client. ```json -// this +// Before update. { "feature_enabled": true, "another_feature_enabled": false, - "something_else": "some_value" // this will disappear + "something_else": "some_value" // this will be kept } -// becomes +// After update. { "feature_enabled": true, "another_feature_enabled": false, + "something_else": "some_value" } ``` -:::