...

/

RubyGems and Railties Can Distribute Configuration

RubyGems and Railties Can Distribute Configuration

Learn about RubyGems and Railties and how they work in Rails applications.

Distribute configuration using RubyGems and Railties

When we have more than one Rails application, there are often libraries we want to share between apps, and those libraries require a common setup. For example, we might use a message bus like RabbitMQ or Apache Kafka for asynchronous communication. We might have a library that provides simplified access to the system, along with configuration settings, such as network timeouts or error-handling behavior.

Or, we might have a convention around using, say, Bugsnag as our exception-handling service and want to have a single set of configuration settings for all apps.

A common way to manage this is to provide documentation about what to do. Or, if we’ve been inspired by the previous section, we could use code generation via a generator or template.

A better solution to this particular problem is to use Railties embedded in Ruby gems. Railties is a core component of how Rails works and is the API for customizing Rails’ ...