Next, run the crud scaffolder: bin/super-scaffold crud Project Team name:text_field It would be fine in this case, but sometimes the subsequent Super Scaffolding step actually updates the migration as part of its magic. In the above example, team represents the model that a Project primarily belongs to. Basic CRUD Scaffolding with crudįirst, generate the model with the standard Rails generator: rails g model Project team:references name:string If you're curious about specific scaffolders or parameters, you can run the following in your shell: bin/super-scaffoldĮxamples 1. The Super Scaffolding shell script provides its own documentation. Prerequisitesīefore getting started with Super Scaffolding, we recommend reading about the philosophy of domain modeling in Bullet Train. Instead, it generates standard Rails code that is both ready for prime time, but is also easy to customize and modify. Furthermore, it does this without leaning on the magic of libraries that force too high a level of abstraction. Super Scaffolding automates the most repetitive and mundane aspects of building out your application's basic structure. Living Templatesīullet Train's Super Scaffolding engine is a unique approach to code generation, based on template files that are functional code instead of obscure DSLs that are difficult to customize and maintain. When adding just one model, Super Scaffolding generates ~30 different files on your behalf. It generates the appropriate routes for the CRUD controllers and API endpoints.It generates breadcrumbs for use in the application’s layout.It adds the model to the application’s navigation (if applicable).It adds the model’s table view to the show view of its parent.It adds the appropriate permissions for multitenancy in CanCanCan’s configuration file.It generates a serializer that’s used by the API and when dispatching webhooks.It generates an API controller and an accompanying entry in the application’s API docs.It generates type-specific form fields for each attribute of the model.It generates a Yaml locale file for the views’ translatable strings.It generates a basic CRUD controller and accompanying views.Here’s a list of what Super Scaffolding takes care of for you each time you add a model to your application: Its goal is to allow you to produce production-ready CRUD interfaces for your models while barely lifting a finger, and it handles a lot of other grunt-work as well. Super Scaffolding is Bullet Train’s code generation engine.
0 Comments
Leave a Reply. |