caramel
Skip to content
Browse documentation
Cookbook / Data and forms

Create a resource.

Generate a book catalog, then make the model, actions, views, and request specs your own.

Draft recipeTarget: 0.4.0Not yet recipe-tested

Where the change goes

app/models/book.crThe stored shape
app/changesets/book.crRules for writes
app/actions/books/Request handling
app/views/books/Browser presentation
spec/requests/books_spec.crBehavior checks

Generate the feature

Run inside a configured application. Review the generated files and migration before applying it.

Terminal
frappe make resource Book title:string author:string
frappe migrate

Prove the behavior

Terminal
frappe check
frappe corretto spec/requests/books_spec.cr

The generated request spec exercises create, read, update, delete, and rejection of invalid requests. Extend it with your own validation rule and an example that fails that rule.