Skip to content

Commit

Permalink
Merge pull request #194 from cloudaper/remove-boolean-group-warning
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianthedev authored Apr 14, 2024
2 parents 2d40fcb + e9115bd commit 87ad125
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions docs/3.0/fields/boolean_group.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
}
```
:::

0 comments on commit 87ad125

Please sign in to comment.