flute
flute copied to clipboard
model validations and update callbacks
In this type of model files: https://github.com/foundpatterns/send-file-package/blob/master/models/slide.yaml
Validation fields: It would be nice to handle fields validations such as (for example):
- Presence;
- Range;
- emptiness;
- string fitting pattern;
- ....
Callbacks events:
It would be also nice to define the name of callbacks to call when an item is created or updated or etc...
For example:
fields:
title:
type: string
validation:
presence: true
body:
type: string
on_create: on_create_my_method
on_create_my_method which is a method defined somewhere by the user of the framework.
Those features in Rails are named Active model and is documented in: https://guides.rubyonrails.org/active_model_basics.html#model