-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add methods for finding or creating records in model
This commit introduces two class methods, `find_or_create_by` and `find_or_initialize_by`, to the `BaseModel` class. - `find_or_create_by` allows the retrieval of an existing record or the creation of a new one with the provided attributes. - `find_or_initialize_by` retrieves an existing record or initializes a new instance without saving it. These enhancements streamline record management within the model, making it easier to handle common data access patterns while promoting cleaner code practices. Generated-by: aiautocommit
- Loading branch information
1 parent
170e7ea
commit f1fd2f2
Showing
1 changed file
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters