-
Notifications
You must be signed in to change notification settings - Fork 2
scaffold options
resty-generators will add some more options to the scaffold/model generators.
- singleton
- timestamps
- modified-by
- optimistic
the first three will affect the signature of a model, i.e. the gwt editor of a model has a read only attributes for each model: id, created_at, updated_at, modified_by. these attributes of model comes in with one of the following option.
- id: singleton
- created_at, updated_at: timestamps
- modified_by: modified-by
the modified class will be User that is hard coded right now. this is class with couple of attributes - no AR or DM or any other persistent framework in place.
the optimistic option needs to have timestamps as well and is merely something for the controller. when finding an existing model the updated_at timestamps must match as well, otherwise the model is stale (if there is a model for the given id). stale model can not be saved or deleted and will response with a conflict http status. AR offers this via an explicit version column and this here is reusing the existing updated_at column.
rails generate scaffold location name:string country:belongs_to
will user Country as belongs_to class both on the rails side as well on GWT side. the editors for that location will have a dropdown list with countries to select a country, i.e. the whole round with creating, updating and deleting such model with belongs_to gets scaffolded and is ready to use.