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...