DEV Community

Cover image for Trailblazer is back, better then ever!
Łukasz Żarski for 2n IT

Posted on

Trailblazer is back, better then ever!

For those who know Trailblazer - you know that for the last 6 years TRB evolved a few times, introduced a lot of great ideas but also had it's problems: missing documentation, lack of communication with the community, and inconsistent approach to some problems. We strongly believe the current version, along with the support of the core team and the new landing page (with complete documentation) is worth working with.

For those who somehow haven't hear about Trailblazer - check it out. Probably for some complex projects where Rails aren't sufficient that tool could be really helpful and efficent.

The main changes coming with the new version of TRB relate to:

  • Major API change,
  • Autoloading,
  • New website with complete documentation,
  • Tracing.

API CHANGES

The updated version 2.1 contains some necessary and sound improvements in the method signatures. One of these changes is the replacement of the automatic merging of params part and additional options with the possibility to pass one hash to the call and do the merging. Second major change in API is that ctx elements are now accessible both as strings and symbols like in a hash. It’s worth noticing that ctx object is now documented in its own section.

# old style
result = Memo::Create.(params, "current_user" => current_user)
# new style
result = Memo::Operation::Create.(params: params, current_user: current_user)

AUTOLOADING

The significant change to autoloading is return to Rails file and class naming structure for operations. This change allowed removing the trailblazer-loader gem, which was responsible for causing some issues and inconsistencies.

NEW WEBSITE

The goal behind creating a new website was to make it as simple as possible. A lot of pages accessible through the top navigation, and then the documentation behind the DOCS link.

The documentation has been structured in such a way as to ensure the fastest possible access to consistent information. There's even added a new search function - something that TRB user base has repeatedly asked for. Just press the / (or Shift+7) button in the docs.

TRACING

The 2.1 version comes with the ability to track the operations - something that was missing in all the prior releases. This change makes debugging deeply nested operations way more pleasant.

Either you know TRB already or you never heard about it, check out the blog post about the history and changes of trailblazer 2.1 and give the core team some feedback!

Top comments (0)