

Discover more from Short Ruby Newsletter
This edition was created with the help ofΒ @adrianthedev/@adrian@ruby.socialΒ fromΒ Avo for Ruby on Rails (a friendly full-featured Rails admin panel) and @jcsrb.
You can jump directly to one of the following sections if you like:
π Our Community
π§° Gems, Libraries, and Updates
π€ Related (but not Ruby-specific)
More content: π₯ π§ π (articles, podcasts, videos, and newsletters)
π Our Community

π Ruby On RailsΒ shared about Ruby scales:

π Someone asked the following question on /r/ruby:

I think it is worth considering if we want to create more contents that is not only for people coming to Ruby from other languages but also learning Ruby as their first programming language.
π All about Code and Ruby
πΒ Jason SwettΒ asked a question about their pain points:Β

Here is a summary of the answers:
βover investing in interactorsβ (@dpaola2)
βPolicies + permissions sneaking into multiple places across the codebase.β (@joemasilotti)
βHandling API validation without leaning too much on AR validations.β (@timcheadle)
βControllers with too many complex options and custom methodsβ (@Diragor)
βHow to break down code which feels like it should belong in the model. That and callbacks.β (@bmozza)
βFront-end code organization. Asset management. Deployment. Automating accessibility testing. HTML emailsβ (@TALlama)
βFile structure, mostly when there si multiple features and country conditionsβ (@barroetald)
βI often find myself having to create custom serializers if i dont want to .includes multiple relations that im not usingβ (@bc2rieg)
βnested serializers and field selection is the absolute worstβ (@eleslovaco)
πΒ Eric BerryΒ shared a sample code in replit about creating a color palette in Ruby:

πΒ Shopify Engineering shared a thread about how they handled Black Friday and Cyber Monday:

You should read the entire thread for more impressive stats. When people ask if Ruby scales show them this.
π Dave Copeland shared a piece of code in Ruby showing how to have a method accept multiple blocks:

I think the conversation between Peter Solnica, James Adam, Ryan Bates, Dave Copeland, and Brandon Weaver about methods of accepting multiple blocks is worth reading on ruby.social.
If you donβt want to read it all, at least look at this code snipped by Brandon Weaver, where he implemented function objects with stack and compose blocks showing the flexibility and beauty of Ruby.
πΒ Matt SwansonΒ shared a view component concept: Fallback slots

πΒ Emmanuel HayfordΒ shared a code sample about Active Record for async queries:

π Noel Rappin asked how the community feels about static typing in Ruby:

Here are some answers:
βI'm hard-pressed to think of it as significantly better than documenting the type or using a convention around naming UNLESS the entire codebase uses it and opting out is not an option. In that case, "lean on the compiler" refactoring is awesome and the only thing I miss from Java.β (@davetron5000@ruby.social)
βitβs the future. Having a compiler tell you about a type bug BEFORE your users do is a lifesaver. Iβve tried using Sorbet with mixed results. Leaning more on dry-types and dry-schema these days, as theyβll give runtime type validations. The code that uses these gems _feels_ saferβ (@Ryanbigg@ruby.social)
βI want to write YARD and have it checked, but if I have to spend time trying to figure out the incantation needed to convince the typing system what Iβm doing is correct, itβs too intrusive. If I need to add boilerplate, itβs too intrusive.
I think YARD + sord + steep is potentially a good synergy but I wish it were more automatic than it is.β (@ZiggyTheHamster@ruby.social)
βfor me it's far more bound to the domain complexity, a lot of which self inflicted through polymorphism or polymorphic associations among other things. I find it to be very useful at boundaries, and less useful in the inner domains. Boundaries, like packs / Packwerk might provide, are domain gates where context is more easily lost on how to interact.β (@baweaver@ruby.social)
These were just a few replies, but the conversation is bigger and worth reading it all. People share a lot of experiences and cases from both sides.
πΒ AyushΒ shared that the book they are working on is almost ready:

πΒ ΠΏΠ°Π½ ZverokΒ shared a code sample about unpacking numbers into binary order of magnitude and prefixes:

πΒ Jakob SkjerningΒ shared a sample code showing how to alias attributes in Active Record:

πΒ Drew BraggΒ shared a code sample showing how Ruby can work with emojis:

π Joel Drapper shared a preview of what might be included in the phlex-markdown:

πΒ Greg NavisΒ shared a thread about Ruby tips about partitioning and grouping arrays:

Please read the thread, as it has an example also about group_by.
πΒ Ryan BatesΒ sharedΒ that it is hard following and reading Ruby code with mixins:

It would be good to read the replies because many people share why the code is complex to read when using many modules as mixins.
π FlavioΒ sharedΒ a thread about various Heroku alternatives:

Here are some alternatives proposed:
replit.com - like a playground suitable for test projects. Each app gets a repl.co subdomain
glitch.com - a playground for Nodejs apps and simple sites
vercel.com - a hosting option for Nodejs with a generous hobby plan
netlify.com - for hosting static sites, they have a great free plan. No backend
CloudFlare Pages - similar to Netlify, no backend but with unlimited bandwidth
render.com - have a free plan, static site hosting can run Node/Python/Rust/Go/Ruby and much more with a free database
railway.com - free started plan, can add multiple apps, with database and support for SvelteKit, Next, Vite, Rails, Nuxt β¦
supabase.com - with a free plan of up to 2GB bandwidth and 1GB file storage for the database, it also has some support for functions using Deno. They have a migration tool for data from Heroku to supabase
fly.io - has a free plan great for experimenting and support for entirely hosting your web app, including database, load balancing, monorepos, and more
dokku - transforms a server/VPS into a Heroku clone
π Sandi Metz announced a 40% discount for the 99 Bottles book, which seems to end on Monday night:

If you have read so far and you like the content, maybe you take into consideration sharing this and subscribing:
π§° Gems, Libraries, and Updates
π§° Marc Anguera Insa shared a new project Tonic - Self meta-described collections framework. It takes a collection defined in an YAML or JSON and automatically generates a beautiful website build with Middleman, Ralix and Tailwind.
π§°Β Alexandre RubanΒ shared a new gem action_markdown that helps to work/displaying markdown content:

If you are looking to use markdown, here are some other possible options markdown-rails or html-pipeline or phlex-markdown
π§° Nate HopkinsΒ publishedΒ hopsoft/reflex_behaviors: Pre-built easy-to-use reactive TurboReflex behaviors for Rails/Hotwire apps.
π§° Gurbaaz Singh Nandra published a code in Ruby to create an interpreter for Ξ»-calculus implemented in ruby
π§° Vladimir DementyevΒ sharedΒ a new EvilMartians gem activerecord-slotted_counters.
Slotted counters help to reduce contention on a single row update in case you have many concurrent operations (like updating a page views counter during traffic spikes)
π§° Ngan PhamΒ shared a PR that was merged to Rails and fixes the deadlock caused by using a fiber inside a transaction:Β Make AbstractAdapter#lock thread local by default
π§°Β Jeremy EvansΒ sharedΒ a new version for Sequel 5.63.0 Released Read the changelog
π§° Aaron PattersonΒ shared a PR they created and merged to Ruby that willΒ Speed up IV writes
π§° Lewis YoulΒ shared a PR for Turbo that allows it to respond with turbo streams to GET requests Allow Turbo Streams with GET via data-turbo-stream
π€ Related (but not Ruby specific)
π€Β Rose WΒ shared small things that can have a lot of impacts in our daily work:

π€Β Jason SwettΒ shared a programming tip:

π€Β BijanΒ shared a tip about submitting an html form tag without Javascript from outside the form. I know this is not something new but I think it is good to remind ourselves about this:

π€Β Celso De SaΒ shared an explanation for Liskov Substitution in Ruby explained by ChatGPT:

π€Β Adam HessΒ shared a new project to explore Ruby WASI:

More content: π₯ π§ π
Slides
Jeremy EvansΒ shared their slides from RubyConf 2022 aboutΒ Helping Redistrict California with Ruby
Benoit DalozeΒ shared their slides from RubyConf 2022 about Splitting: The Crucial Optimization for Ruby Blocks
Noel Rappin shared their slides from RubyConf 2022 about In Defense of Metaprogramming
Newsletter
π Any CableΒ published a new editionΒ Any Cables Monthly #5 β November, 2022
π Ruby on Rails published a new edition of This Week in Rails curated this week by Wojciech WnΔtrzak
π Ruby Radar published a new edition: Ruby Radar #79
ποΈ Ruby Weekly published a new edition: Let's create a basic (useful) Ruby C extension
ποΈ Ruby LibHunt published a new edition of the Awesome Ruby Newsletter
π Women on Rails published a edition Newsletter #40
Podcasts
π§ Jason SwettΒ published a new episode aboutΒ 165 - Upgrading Rails with Ernesto Tagwerker
π§ Remote RubyΒ published a new episode aboutΒ New Ruby versions, the Pay gem, and the new GitHub file browser
π§ The Ruby on Rails PodcastΒ published a new episode aboutΒ The Rubyconf Mini Podcast Panel
π§ Remote RubyΒ published a new episode aboutΒ New Ruby versions, the Pay gem, and the new GitHub file browser
Videos
π₯ Andrew Culver shared a video from Rails SaaS conference by Nadia Odunayo: Getting to One Million Users as a One-Woman Dev
π₯ Drifting RubyΒ published the video version of Β This Week in Rails - Dec 2nd, 2022
π₯ Tom Stuart shared a video where they show they could replace Struct with Data.define without incidents: Making a WebAssembly interpreter in Ruby, part 17: Ruby 3.2, branch targets and function calls
Articles
Avo published the second part of their series of articles about How Successful Agencies Ensure Dev Happiness Part 2
Andrei KaleshkaΒ published a new article aboutΒ Keep DB schema clean and consistent between branches
Ryan Bigg published a new blog post about Hanami 2.0
David CopelandΒ published an article aboutΒ Dealing with Flaky Tests
Ruby Lib HuntΒ shared an article aboutΒ Pending migrations now show path instead of filename
Β Kevin NewtonΒ published the second article about YARV, the virtual machine of CRuby: Β Advent of YARV: Part 2
AvoΒ published an article aboutΒ Nested records when creating
Ryan DavisΒ sharedΒ an article showing Correct Delegation with Ruby 2.6, 2.7 and 3.0
Rob Mc CormickΒ sharedΒ their article about Know Rails? How to get started with Bridgetown
The Ruby DevΒ sharedΒ an article written by David Santangelo Ruby multithreaded crawler