How to create a component-based Rails application

Components can improve maintainability, reduce complexity, and accelerate testing in large Rails applications

Become An Insider

Sign up now and get FREE access to hundreds of Insider articles, guides, reviews, interviews, blogs, and other premium content. Learn more.

The use of the components approach in Rails can improve maintainability, reduce complexity, and accelerate testing in large Rails applications.

In preparation for creating your first component-based Rails application (CBRA) app, you should ensure that your system is up to date with regard to Ruby and Rails. I suggest using the latest published versions of both Ruby and the Rails gems. The way I have my system set up, using the Ruby Version Manager (RVM), is something like the following:

Install rvm, bundler, and rails. 
Execute anywhere $ rvm get stable $ rvm install 2.4.2 $ gem install bundler -v '1.15.4' $ gem install rails -v '5.1.4'

The entire app inside a component

In this section, we will be creating a Rails application that contains no handwritten code directly in the app folder and instead has all code inside an engine mounted into the application.

To continue reading this article register now