Tutorials

Use to_sql to see what query ActiveRecord will generate
If you’re trying to write a tricky ActiveRecord query that includes joins, complex where clauses, or selecting specific values across tables, it can be hard to remember every part of the ActiveRecord DSL.Is it joins(:orders) or joins(:order)? Shou...


Sharing common code between Rails controllers with Scoped pattern
This particular pattern comes from DHH and Basecamp – a codebase that prides itself of using lots of tiny concerns to share bits of behavior.While the savings of repeating the same before_actions to look up a Channel would be a fine benefit on it’...




Recording real requests with WebMock | Arkency Blog
Caveat: it’s global, i.e. it’ll apply to all the test cases you’ll run. If you want it for just one test case, run just a single one.(As far as I tried, there’s no easy way to cleanly make it per-example with an around hook, because that would mea...



Build a Ruby App with CockroachDB and ActiveRecord | CockroachDB Docs
Learn how to use CockroachDB from a simple Ruby script with the ActiveRecord gem.This tutorial shows you how build a simple Ruby application with CockroachDB and ActiveRecord. CockroachDB provides an ActiveRecord adapter for CockroachDB as a RubyGem.