Skip to content

Commit 1432973

Browse files
committed
callable disabled_features
1 parent d83a1a9 commit 1432973

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

docs/3.0/customization.md

+9
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,15 @@ Avo.configure do |config|
397397
end
398398
```
399399

400+
<VersionReq version="3.13.5" /> `disabled_features` become callable. Within this block, you gain access to all attributes of [`Avo::ExecutionContext`](execution-context)
401+
402+
```ruby{3}
403+
# config/initializers/avo.rb
404+
Avo.configure do |config|
405+
config.disabled_features = -> { current_user.is_admin? ? [] : [:global_search] }
406+
end
407+
```
408+
400409
After this setting, the global search will be hidden for users.
401410

402411
Supported options:

docs/3.0/search.md

+9
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,15 @@ Avo.configure do |config|
271271
end
272272
```
273273

274+
<VersionReq version="3.13.5" /> `disabled_features` become callable. Within this block, you gain access to all attributes of [`Avo::ExecutionContext`](execution-context)
275+
276+
```ruby{3}
277+
# config/initializers/avo.rb
278+
Avo.configure do |config|
279+
config.disabled_features = -> { current_user.is_admin? ? [] : [:global_search] }
280+
end
281+
```
282+
274283
### Scope out global or resource searches
275284

276285
You may want to perform different searches on the `global` search from the `resource` search. You may use the `params[:global]` flag to figure that out.

0 commit comments

Comments
 (0)