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.
pixelart gem in action - Bixel and Biixel Image class for paint by number or letter
is it ordinal summer? i’ve written-up a step-by-step guide to define your own paint by number or letter image class - using the bixel (7x7px - 10 colors) and biixel (10x10px - 21 colors) specs / protocols as real-world examples. happy pixel (or bixel or biixel) pushing with ruby.
Eloquent code needs no comment
Comments are often a tell that the code could be more explicit. Every time I write a comment, I refactor my code to be understandable without it : http://alexis.bernard.io/blog/2023-08-11-eloquent-code-needs-no-comment.html
Sharding in Rails 7: A New Horizon in Database Management
Looking to scale your Rails applications? Dive into the world of sharding with Rails 7 in this comprehensive guide. From automatic role switching to horizontal sharding, this article explores the tools and techniques to efficiently manage large-scale applications. Check it out at https://psmy.medium.com/sharding-in-rails-7-a-new-horizon-in-database-management-6527e34ea8d8 and stay ahead of the curve!
Preview emails in Rails with letter_opener, MailCatcher and MailHog 🐷
I recently published an article diving deep into previewing your ActionMailer emails — Preview emails in Rails with letter_opener, MailCatcher and MailHog
Trailblazer Tales #07 explains nesting
In the newest episode we’re back with a video of how to nest operations in Trailblazer. https://www.youtube.com/watch?v=kEYSIda7UHY
Rails has_one Nested Attributes Tweaking
When it comes to Rails nested attributes and has_one
relationships, things can get a little weird. This article mentions a few options that you might want to fiddle with in these situations. https://goodenough.us/blog/2023-08-07-til-rails-has-one-nested-attributes-tweaking/
Video: Integrate ChatGPT with Rails 7: Step-by-Step Tutorial
I provide a comprehensive guide to building a Ruby on Rails frontend that interfaces with OpenAI’s ChatGPT. Covering user management, conversation creation, and the ability to continue conversations at any time, this tutorial is tailored for both new and experienced developers eager to embrace the power of AI-driven communication. Watch the video here: https://youtu.be/_3AsaXoLdj4.
Ruby's bang methods - Handle with care!
In Ruby, method names can be suffixed with !. These are often called “bang” methods. This is used to indicate that it is a dangerous counterpart of the non-bang version of the method. [more inside]
Maquina, the engine for Rails
Building apps over time, I found some work that needs to be done on every application: Authentication, Authorization, Mailers, etc. I started extracting this standard functionality into a Rails engine a few years ago. Later, tailwindscss, hotwire, stimulus, and phlex entered the picture, so I started the engine again with reusable UI patterns that take advantage of these tools. This is how Maquina was born. https://mariochavez.io/desarrollo/2023/08/08/maquina-the-engine-for-rails/
Rubidity - A Ruby Dialect for Dumb (Blockchain) Contracts
Hello, some years ago I published a red paper to introduce sruby - Small, Smart, Secure, Safe, Solid & Sound (S6) Ruby to the world with a runtime (and gem) called universum. Now fast-forward and middlemarch (a.k.a. Tom Lehman) introduced dumb contracts on ethscriptions with the production code written in a dialect of Ruby called “Rubidity”. Q: Why do you choose ruby for dump contracts? A: Because you can create a mini-language that’s very similar to Solidity and will be easier for Solidity devs to use. Hear. Hear. Update I started a rubidity sandbox to experiment and study and learn together. join us.
Safe redirects in Rails 7
When enforcing canonical URLs, sometimes I find myself wanting to perform a redirect while retaining most of the params. It’s tempting to use params.merge
to build the redirect in this case, but this is risky from a security standpoint. In this article I’ll explain how to perform redirects like these safely in Rails 7. https://mattbrictson.com/blog/safe-rails-redirects
Materialized views in Rails
https://raghu-bhupatiraju.dev/implementing-materialized-views-in-rails-ffea22bd5d9c
Pre-orders are live for RailsNotesUI ActionMailer components! 📬
I’ve just launched pre-orders for https://railsnotesui.xyz , where I’m building a component library of ActionMailer email components. Rather than hard-coding HTML <tables>
, you’ll be able to build emails with ViewComponents like Email::Button
and Email::Footer
. [more inside]
ordinals gem v1.3 update - now incl. doginal shibescription api. much wow
is it doginal summer? i’ve updated the ordinals gem - a light-weight (free, no api key required) ordinal api wrapper / client for inscriptions (letting you fetch metadata and content) and bonus the new version 1.3 now includes support for doginal shibescriptions (via wonky-ord.dogeord.io). much wow! very happy data analytics and pixel pushing with ruby.
Simplifying UI Testing with data-testid in RSpec & Capybara
Revisiting UI testing approaches, I’ve shifted to using data-testid
for better efficiency and robustness. My new blog post dives into how you can use it with RSpec & Capybara and introduces custom matchers to help. Check it out.
[Screencast] PDF Reader
When previewing PDF files that were uploaded through Active Storage, we can only get a simple image of the first page. In this episode, we’ll look at taking the uploaded PDFs and interacting with them. https://www.driftingruby.com/episodes/pdf-reader
Skipping the console with Rails Runner
Hey RubyFlow, I recently published an article on skipping the rails console with rails runner. [more inside]
Ruby Step-By-Step Guide - Inside Sub1k - The First Thousand Ordinal Inscriptions
is it ordinal summer? i’ve updated the free (online) programming ordinals (in ruby) step-by-step guide / booklet. the new bonus chapter titled Sub 1k - Inside The First Thousand Ordinal Inscriptions - Litecoin Edition shows you how to build a (local) sub1k sqlite database (from scratch / zero) with all metadata and content blobs (using the ordinalslite.com api) - it’s about 160 MB - and than query for analytics / statistics via sql (using activerecord and ordlite). happy programming (and data analytics) with ruby.
Ruby on Rails and the Power of MVC Architecture: A Comprehensive Guide
In the landscape of modern web development, few frameworks have had as profound an impact as Ruby on Rails (RoR). Powered by the elegance of Ruby and the efficiency of the Model-View-Controller (MVC) design pattern, Rails provides developers with tools to craft scalable and maintainable applications. Read at: https://medium.com/@psmy/ruby-on-rails-and-the-power-of-mvc-architecture-a-comprehensive-guide-b50f55950ee0
Split your database seeds.rb by Rails environment
Hey RubyFlow, I just posted a handy article covering how to split your database seeds by Rails environment. Hope you find it useful!