diff --git a/docs/3.0/customizable-controls.md b/docs/3.0/customizable-controls.md index ee803244..1aa72d63 100644 --- a/docs/3.0/customizable-controls.md +++ b/docs/3.0/customizable-controls.md @@ -308,7 +308,6 @@ actions_list edit_button # form (edit & new) controls - back_button delete_button actions_list diff --git a/docs/3.0/search.md b/docs/3.0/search.md index 456dd634..5fa10f50 100644 --- a/docs/3.0/search.md +++ b/docs/3.0/search.md @@ -304,8 +304,9 @@ In the above example, ransack is used to search for `Application` records based This approach allows for flexible searching within associations, enabling you to find records based on related model attributes. ## Results count -:::info Since version -::: + + + By default, Avo displays 8 search results whenever you search. You can change the number of results displayed by configuring the `search_results_count` option: ```ruby @@ -316,22 +317,23 @@ end You can also change the number of results displayed on individual resources: -```ruby -# resources/user.rb - -self.search: { - results_count = 5 -} +```ruby{3} +class Avo::Resources::User < Avo::BaseResource + self.search = { + results_count: 5 + query: -> {}, + } +end ``` -You can also assign a lambda: - -```ruby -# resources/user.rb +You can also assign a lambda to dynamically set the value. -self.search: { - results_count = -> { user.admin? ? 30 : 10 } -} +```ruby{3} +class Avo::Resources::User < Avo::BaseResource + self.search = { + results_count: -> { user.admin? ? 30 : 10 } + } +end ``` -If you configure results_count by specifying it in the resource file then that number takes precedence over the global search_results_count for that resource. +If you configure `results_count` by specifying it in the resource file then that number takes precedence over the global [`search_results_count`](#results-count) for that resource.