DEV Community

Ariejan de Vroom for Kabisa Software Artisans

Posted on • Originally published at kabisa.nl on

Rails without tha added sugar

A modern web application has many moving parts, Ruby on Rails is no exception. With a new Ruby on Rails 6.1 application there's a lot you get for free.

What you get for free:

  • Outgoing email handling (action_mailer)
  • Incoming email handling (action_mailbox)
  • Text markup / editing in the browser that works (action_text)
  • Compiling and bundling static assets like CSS, JavaScript, fonts and images (sprockets)
  • Making use of the whole NPM ecosystem for front-end technology (webpacker)
  • Background workers (active_job)
  • Websockets with fallback (action_cable)
  • An awesome DSL to generate JSON (jbuilder)
  • Make your application load faster in the browser (turbolinks)
  • Increase performance by caching expensive computations (bootsnap)
  • Application pre-loader (spring)
  • Store files locally or in the cloud (active_storage)

However, there are times you want to start with something simpler, without
the burden of all these extras.

A minimal approach

You could use all the --skip-* options to disable each of these, but
Rails 6.1. packs the --minimal option instead:

rails new my_app --minimal
Enter fullscreen mode Exit fullscreen mode

It should be noted that this does not imply a classic Rails app, as
DHH eloquently put it:

Classic gives it an air of cool that I'm not interested in. It's not about reminiscing of some glorious past. It's just "I want the bare minimum"

That bare minimum is a great starting point if you're not yet ready for all the goodies and
maybe uncertain whether you're going to need them at all. Adding the ones you need later it
just like adding any other gem to your Rails project.

I'm a big proponent of this approach, as less dependencies (you don't use) means your codebase
will be easier to maintain and upgrade in the future.

More points with combos!

If you're really into front-end and would like to use webpacker with a minimal Rails app,
that's possible too. Selecting a specific database adapter is also still possible.

rails new cool_app --minimal --database postgresql webpack=react
Enter fullscreen mode Exit fullscreen mode

Top comments (0)