app/concepts/invoices/.).Įxisting controllers, models and other code can peacefully coexist with TRB files - it’s a refactoring framework meant to be used in your seasoned application. In Trailblazer all file and class names are singular which means you don’t have to think about whether or not something should be plural (it is still possible to use plural names, e.g. Keep in mind that it is also possible to use nested concepts as in app/concepts/admin/ui/post. Trailblazer files are structured first by concept, then by technology, where the first represents the domain name like “blog post” and the latter an abstraction layer like operation, contract or cell. You can always discover a Trailblazer application in Rails by the app/concepts directory. Traiblazer-rails adds one single method #run to the ApplicationController which provides a short-cut to invoke operations in controller actions.įor the rendering part, we require simpleform because it makes rendering forms (and erroring forms) super simple! The dry-validation gem integrates with Reform and allows defining validations for our form objects. The trailblazer gem pulls all best-practice gems of the Trailblazer project, like the operation, macros, and reform bindings. Gem "trailblazer-developer", path: "./trailblazer-developer" The operations use simple form objects provided by reform to validate data. We are going to create very primitive CRUD operations to create, update, show, and delete a BlogPost model.
#Magic bullet looks 2.1.0 how to#
how to use Cells to replace Rails views with a better abstraction - in this guide will are using vanilla Rails views.why it’s a good idea to harness trailblazer-rails gem in your controller.
#Magic bullet looks 2.1.0 software#
Now that we’ve learned what operations do and how Trailblazer provides convenient macro steps to ease your life as a software engineer, it’s time to check out how to leverage operations and form objects in Rails.