active record

Composable Query Builders in Rails with Arel

We'll use Arel to build a flexible query builder class that will allow us to dynamically search our database given any search form input. This post focuses less on building intricate Arel queries and more on enacting a design pattern that allows us to leverage Arel in a…

Smarter Rails Services with Active Record Modules

MVC is Not Enough! We're familiar with the MVC (Model-View-Controller) pattern that Rails offers us––our models map to database tables and wrap our data in objects; controllers receive requests for data and serve up data to the views; views present the data. A common analogy is that…

Managing Multiple Databases in a Single Rails Application

What? Why? It may sound crazy at first, since most of the Rails applications we tend to work with connect to just one database. But, it actually isn't that unusual to have a single app communicate with more than one database. Consider the following use cases: source [http:…