- Short Ruby Newsletter
- Posts
- 👋 Short Ruby News - edition #21
👋 Short Ruby News - edition #21
Briefly about everything in Ruby world
This edition was created with the help of @adrianthedev/@[email protected] 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:
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.” (@[email protected])
“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” (@[email protected])
“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.” (@[email protected])
“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.” (@[email protected])
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.
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)
🤝 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
Reply