Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 0
Repository
Mattia Roccoberton edited this page May 2, 2023
·
1 revision
ActiveRecord component to prepare the queries for resources' actions.
Sample:
# Change the repository globally:repository: TinyAdmin::Plugins::ActiveRecordRepositoryOr locally in a resource section:
sections:
- slug: postsname: Poststype: resourcemodel: Postrepository: MyRepositoryThen define your repository:
classMyRepository < TinyAdmin::Plugins::ActiveRecordRepository# override specific methodsdefcollectionmodel.some_nice_scopeenddefshow_title(record)"MyModel #{record.name}"endendIf you prefer you can create your own Repository, I would suggest to inherit from TinyAdmin::Plugins::BaseRepository in that case.
Take a look at the sample_features_app in the extra folder for a complete example of a custom repository.