#​689 — February 8, 2024

Read on the Web

Together with  FastRuby.io

Ruby Weekly

emirb: An Experimental Build of IRB for the Browser — What a neat demo! Yusuke, of the Ruby core team, has put together this browser based IRB experience using ruby-wasm-emscripten and xterm-pty to create the terminal experience seen here. Yusuke has written more about the process here [JA] (it’s in Japanese but translates well).

Yusuke Endoh

Turbo 8 Released — While Turbo is mostly a suite of frontend technologies, they’re becoming fundamental for the development of fast, modern Rails apps. 8.0 introduces a DOM morphing approach for smoother and more selective page updates (example, supports the View Transition API, and can pre-load links prior to users clicking on them.

37signals

Need to Upgrade Rails? Let’s Talk 🚀 — Need an expert? Top-notch engineering teams (from startups to Fortune 500 companies) trust the FastRuby.io team in mission-critical upgrades. Leverage our 30,000+ dev/hs of experience: Get to Ruby 3.3 and Rails 7.1 in weeks with zero downtime 🔥

FastRuby.io Upgrade Services sponsor

First Steps with ruby.wasm: or How We Built Ruby Next Playground — The Ruby Next playground allows the execution of Ruby in the browser by using WASM and WASI to create an in-browser Ruby VM. This post digs into how it was built and why it could be useful. This is more about compiling and running programs than was the REPL-based emirb above.

Dementyev and Turner (Evil Martians)

📕 Articles & Tutorials

Running Open-Source AI Models Locally with Ruby — If you want to use company or sensitive data with AI models, or simply don’t want to give OpenAI or Google any more money, running them locally is a good idea. Running an LLM in Ruby isn’t really viable, but Ollama makes it easy to run models locally and then call into them from your Ruby code – here’s how.

Kane Hooper

Building Reusable UI Components in Rails with ViewComponent — ViewComponent provides a nice way to make your views a bit more modular and loosely coupled when it comes to the components they’re made up of, rather than just leaning on partials.

Michael Barasa

💡 Be sure to also see Phlex (below) for an alternative approach.

How to Deploy a Rails App to a VPS with Kamal — Building your app is only half the battle – the other half is deploying it. Learn how easy deploying can be with Kamal. 🚀

Honeybadger sponsor

An Overview of RSpec Test Types in Rails — Knowing how and what to test can feel more like art than science. This list of the test types that are important for practical Rails testing, along with RSpec examples of each, may help you refine your approach.

Thomas Riboulet (AppSignal)

The Secret Tool to Launch Your Rails Business in the App Stores — Spoiler: It’s Turbo Native ;-)

Joe Masilotti

Using Solid Queue in Development with Docker and on HerokuSolid Queue, open sourced by 37signals last month, is a database-based queuing backend for Active Job.

Spike Ilacqua

TIP: Read the .ruby-version File Into Your Gemfile — To prevent confusion.
Andy Croll

▶  How to Add Live Reload to Your Rails App — Using esbuild.
Webcrunch

What is __FILE__ in Ruby?
Akshay Khot

🛠 Code & Tools

Phlex: A Component-Oriented View Framework — Phlex lets you treat everything on a page as a distinct component and build them all with Ruby itself. We’ve mentioned it a few times in the past year, but it now has a nifty new homepage that communicates the idea well and gets you up to speed quickly.

Joel Drapper

💡 Streaming Phlex from Sinatra makes for an interesting use case. GoRails has also just dropped ▶️ Components with Phlex in Rails!

HTTP.rb / HTTP 'The Gem!' 5.2: The Fast Ruby HTTP Client — I’m a big fan of the http gem, both for its memorable name 😏 and because it’s flexible while having an easy to remember API (the wiki docs are a big help, too). v5.2 is the first release since 2022, though, so it’s good to see it getting an update.

http.rb team

Worried About Your Ruby on Rails Application's Security? — Never worry about outdated code again - CodeCare Shield ensures your Ruby on Rails app stays up-to-date and optimised.

reinteractive/CodeCareShield sponsor

Mission Control — Jobs: Dashboard Extensions for Solid Queue — If you followed the Solid Queue release, you know it came with no web UI to manage jobs. 37signals has rectified that by open sourcing their frontend for it. GitHub repo.

Rosa Gutiérrez (37Signals)

after_commit Everywhere: Use Active Record Transactional Callbacks Outside of Models — Not just outside of Active Record models but, well, anywhere in your app. Check the examples in the README to get the idea.

Andrey Novikov