LIKE US FOR UPDATES + GET A FREE STICKER PACK!

Getting Started

Last updated 18 July 2016

Setting up Trailblazer in projects is usually not more than installing a few gems.

This guide will walk you through the configuration of all major frameworks such as Rails, Sinatra, Hanami and Roda.

Installation

As Trailblazer is highly modular, you have to make sure you include the correct gems in your Gemfile.

Here’s a Gemfile example for a Rails application.

gem "trailblazer"
gem "trailblazer-rails"

# optional, in case you want Cells.
gem "trailblazer-cells"
gem "cells-erb"         # Or cells-haml, cells-slim, cells-hamlit.
gem "cells-rails"

This will also load reform and reform-rails making the integration very smooth.

Configuration

You can configure what validation engine you want to use.

In Rails, use an initializer, e.g. config/initializer/trailblazer.rb for that.

Rails.application.config.reform.validations = :dry

If omitted, ActiveModel::Validations will be configured, per default.

Note that you can still use alternative validations per form class.

Stack

  • Slim recommended (works with all gems such as Formular)