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.
Rubber Duck Dev Show Episode 65 | Callbacks: Good or Evil?
Rubber Duck Dev Show Episode 65 is released! In this episode, we discuss whether Ruby on Rails Active Record callbacks are good or evil: https://www.rubberduckdevshow.com/episodes/65-callbacks-good-or-evil/
Deploying Rails and Sidekiq to Fly.io
Learn how to deploy a typical Rails application to Fly.io including PostgreSQL and Redis.
NSA recommends Ruby as one of 5 languages
“ C#, Go, Java, Ruby, Rust, and Swift” The NSA recommends to use one of these languages to prevent memory based attacks. Memory violations cause up to 70% of all security violations regarding to Microsoft and Google researchers. A great day for Ruby! If someone asks you why you use Ruby for your project you can simply point them to this article https://media.defense.gov/2022/Nov/10/2003112742/-1/-1/0/CSI_SOFTWARE_MEMORY_SAFETY.PDF
The inherent unreliability of after_commit callbacks and most service objects
Service objects and/or after_commit callbacks are ubiquitous in most real-world Rails applications. Whether it’s a good idea or not (ActiveRecord callbacks - I’m looking at you) is a different story, but one thing that is notoriously overlooked in the application design is reliability. And yes, the service objects are equally bad as after_commit callbacks in that regard. [more inside]
Released ActiveWorkflow 0.9.16
ActiveWorkflow 0.9.16 has been released. This is a minor release that adds the ability to wipe out workflow state (useful during workflow development) by removing all messages, log records and agent memory with a single button (with confirmation, just in case). Heroku “demo” mode was removed since a free tier seems to be no longer available (you can still deploy to Heroku with your own configuration). Multiple dependencies were updated.
Released command_kit 0.4.0
Released command_kit 0.4.0. Adds modules for invoking the default text editor (aka $EDITOR), also printing key/value fields, bulleted lists, and tables in a variety of formats (see examples/printing/tables.rb)!
Released ruby-nmap 1.0.0!
Released ruby-nmap 1.0.0! This major release switches to the brand new command_mapper library (which handles mapping in nmap options to class attributes), adds support for more nmap options, and improves parsing of structured NSE script output data from nmap XML output. See the UPGRADING guide on how to upgrade from 0.10.0 to 1.0.0.
Sorting ActiveRecord results by enum values (in SQL)
in_order_of is a new method in Rails 7 that allows you to sort by enum values directly in SQL [more inside]
artfactory gem in Action - Generate Pixel Art Via Text-To-Image Prompts
Hello, In the ongoing learn pixel art programming with ruby series I put together a new artfactory gem that let’s you generate pixel art via text-to-image prompts - no A.I. training or models needed / required ;-). The “magic” works via all-in-one image spritesheets (and meta datasets in .csv). To get you started I “right-clicked & saved” about a dozen “on-blockchain” artwork layers for easy “off-blockchain” (re)use. Happy pixel pushing and profile pict(ure) pixel art generation with ruby.
How to Send Tailwindcss-Styled Emails With Ruby on Rails 7
Have you ever tried to create a good-looking email design from scratch? Or how about using TailwindCSS to write your email layouts? [more inside]
Spotting flaky tests
Sharing some examples of flaky tests from my experience. https://tejasbubane.github.io/posts/2022-11-08-spotting-flaky-tests?utm_source=rubyflow
25 Days of Punk (Pixel) Head / Character Art Collections - December 1st to 25th
Hello, Some years ago I used to organize and publish “25 Days of Ruby Gems - Ruby Advent Calendar 2020, December 1st - December 25th” and such (ironically I am cancel-cultured and perma-banned twice in the ruby world, that is, on r/ruby and ruby-talk (- see the (Ruby) Case Studies @ Choose A Conduct for the backstory). Anyways, let’s (re)try and revive the tradition with a punk (pixel) art twist (or is that pivot?). The idea is to publish a (free ruby pixel art programming how-to) article a day starting December 1st, 2022 that shows how you can put together (yes, you can!) do-it-yourself (DIY) a punk (pixel) art collection (from scratch). Yes, in ruby. You are more than welcome to “claim” a day and sign-up for an article in the series. .
How to Scale Ruby on Rails Applications
Check out some ways to scale your Ruby on Rails applications, including with caching and background workers. https://blog.appsignal.com/2022/11/09/how-to-scale-ruby-on-rails-applications.html
Rails 7.1 allows ActiveRecord::QueryMethods#select & #reselect to receive hash values
Rails 7.1 adds the ability to pass a hash of columns and aliases to be selected with the ActiveRecord::QueryMethods#select and ActiveRecord::QueryMethods#reselect methods. [more inside]
Spektr, a static-code analyser for Rails, to find security issues
Spektr is a static-code analyser for Ruby On Rails applications to find security issues. [more inside]
Hanami v2.0.0.rc1
Preparing for stable release in two weeks: https://hanamirb.org/blog/2022/11/08/announcing-hanami-200rc1/
Thank you, Heroku and new site address
I’ve hosted my site on Heroku for over 13 years, but I’ve now rewritten it and deployed it to GCP under a new domain: rosenfeld.page. Here’s the last article with the announcement.
Rubber Duck Dev Show Episode 64 | Where To Put Your Business Logic With Jason Charnes
In this episode, we talk with Jason Charnes about where you should store your business logic in your Ruby on Rails application framework: https://www.rubberduckdevshow.com/episodes/64-where-to-put-your-business-logic-with-jason-charnes/
[Screencast] Infrastructure Migration
For various reasons, we may decide to move our services off of one platform onto another. This could be due to pricing, uptime or other reasons. In this episode, we look at migrating a Ruby on Rails application and database from Heroku to Fly. https://www.driftingruby.com/episodes/infrastructure-migration
Writing Neovim plugins with Ruby
I learnt about writing remote plugins for Neovim. I built a small tool to evaluate Ruby code right within Neovim: [more inside]
[ANN] Perfect Shape 1.0.6 Released
PerfectShape is a collection of pure Ruby geometric algorithms that are mostly useful for GUI (Graphical User Interface) manipulation like checking viewport rectangle intersection or containment of a mouse click point in popular geometry shapes such as rectangle, square, arc (open, chord, and pie), ellipse, circle, polygon, and paths containing lines, quadratic bézier curves, and cubic bezier curves, potentially with affine transforms applied like translation, scale, rotation, shear/skew, and inversion (including both the Ray Casting Algorithm, aka Even-odd Rule, and the Winding Number Algorithm, aka Nonzero Rule). Additionally, PerfectShape::Math contains some purely mathematical algorithms, like IEEE 754-1985 Remainder. https://github.com/AndyObtiva/perfect-shape
Rails changelogs as a html page
I’ve created a small site which checks the rails/rails repo daily for changes to the various CHANGELOG.md files and make them pretty with link backs to the PRs: [more inside]