The Ruby and Rails community linklog
Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!
Submit a post
Post Preview
Note: Only the first pargraph is shown on the front page and overly long paragraphs may be broken up.
Five Turbo Lessons I Learned the Hard Way
I’ve been keeping some notes of the stuff that wasn’t obvious to me as I started using Turbo, and I thought they might be helpful for other folks. [more inside]
Using Hotwire with Rails for a SPA like experience
Let’s create a SPA-like navigation using Turbo Frames, and add use Stimulus to add some polish, such as loading states and keeping track of the selected item. [more inside]
Glimmer Connect 4
Glimmer DSL for SWT 4.20.13.14 shipped with a Connect 4 elaborate sample. It is implemented as a 2-player game that is very similar to Tic Tac Toe in implementation except that it relies on a hybrid canvas widget/shape approach to lay out the slots. [more inside]
Pixel Art Programming - Make Your Own Dodge Shiba Inu Punks (32x32) - Much Wow
Hello, I have put together a new (free) punk pixel art series that includes four shiba inu variants - classic, dark, alien and zombie - and some first attributes such as beanie, headband, cap, knitted cap, 3d glasses and more. Let’s generate a classic shiba inu dodge punk (32x32) with 3d glasses from scratch using the pixelart gem.
Mastering Rails time operations
Rails ActiveSupport time methods are slow. [MORE INSIDE]
Building a Documentation Workflow in Rails
Good docs make happy customers. But documentation is HARD. You have to figure out what’s important and write it up in a way that’s tailored to your audiences and consistent across the site. Now you need to set up a website, publish the docs and maintain them as your product changes. Fortunately, we have seasoned technical writer Kate Bartolo here to walk us through the whole process. https://www.honeybadger.io/blog/documentation-worklow-rails/
Glimmer Parking Sample
Glimmer DSL for SWT 4.20.13.13 added a new Parking elaborate sample that acts as a building’s parking booking system at its entrance. [more inside]
Rails 7 allows setting cache expiry, as an absolute timestamp
Rails caching has always had an expires_in method, which allows us to set cache expiry in relative time. [more inside]
Benry-recorder gem records method calls
Benry-recorder gem 1.0.0 released, a tiny utility to record method calls. It can also define fake methods and create create fake object. https://github.com/kwatch/benry-ruby/tree/ruby/benry-recorder
Using ActiveRecord's #update_counters to Prevent Race Conditions
Race conditions are arguably the most insidious kind of bug; they’re intermittent, subtle, and most likely to occur in production. ActiveRecord’s update_counter provides us with a convenient way to avoid race conditions when incrementing or decrementing values in the database. In this article, Jonathan Miles shows us how to use it, how it’s implemented, and other approaches to avoiding race conditions.
https://www.honeybadger.io/blog/activerecord-update-counters-race-conditions/
A complete guide to testing routes with RSpec
There are a few reasons why you might want to test the routes of your application, we go into those and how to test the most common routing patterns. [more inside]
Powerful Emacs Snippets
In this post, I documented the process of customizing one of my Ruby snippets to have some code expanded conditionally. I used Emacs, but the general idea may apply to snippet packages of other editors. [more inside]
Analyzing Heroku logs in real time
How an open source tool helps you extract fields and perform aggregations on your Heroku logs. All in real-time, with beautiful, human-readable output.
Conway's Game of Life Glimmer Sample
Glimmer DSL for SWT 4.20.13.11 just shipped with an implementation of Conway’s Game of Life. A simpler version was blogged about many years ago, but it has been enhanced to be canvas-based instead of button-based. [more inside]
[Screencast] Hotwire Turbo Replacing Rails UJS
In this episode, we look at some common functionality that we got with Rails UJS and what it looks like to reimplement these with Hotwire’s Turbo and StimulusJS. https://www.driftingruby.com/episodes/hotwire-turbo-replacing-rails-ujs
Deprecating code in a Rails application
I just shared a quick post on how to add deprecation warnings to a Rails app, and why you might want to, on Everyday Rails. Hope you find it useful!
Glimmer Klondike Solitaire + Canvas Shape Drag & Drop
Glimmer DSL for SWT 4.20.13.x added direct support for Canvas Shape Drag & Drop, which automates drag and drop operations for shapes within a canvas and is used to build the new Klondike Solitaire elaborate sample. [more inside]
BFS and DFS algorithms in Ruby
Check out my post about implementing depth-first search and breadth-first search in Ruby
Webpack ALL The Assets
With the release of Rails 6, Webpack was introduced as the default JavaScript bundler by using the Webpacker gem. We tend to think about Webpack only as a tool to handle JavaScript files, but it can be used to handle all kinds of asset files. This article shows how to create a Rails app that uses only Webpack to handle all the assets, including images, fonts, styles and videos. [more inside]
Open Source Thursdays Expert Session with Rafael França on Aug 5th
Did you always want to get started with contributing to Rails? It can be overwhelming, right? [more inside]
Deploying Rails to AWS Lambda
Lambda is an excellent option for deploying lower-traffic web services when you don’t want to maintain another server and you want easy access to all of AWS’s other services. In this article, Godwin Ekuma shows us step-by-step how to deploy our Rails apps to AWS Lambda. https://www.honeybadger.io/blog/rails-lambda/
Introducing JavaScript and TypeScript client for AnyCable
Vladimir Dementyev from Evil Martians introduces a fresh take on a client library for Rails Action Cable. Implemented in JavaScript and TypeScript, it is intended for the free and pro users of AnyCable, giving them a handful of new features, but is also 100% compatible with vanilla Rails for a more modern, maintainable, and robust client code.