- Short Ruby Newsletter
- Posts
- 👋 Short Ruby - edition #16
👋 Short Ruby - edition #16
Briefly about everything happening in Ruby world
If you want a short excerpt of this newsletter containing only some of the images with code, I created one here. But I invite you to read the entire newsletter as it has excellent content 😊.
This edition was created with support from @adrianthedev from Avo for Ruby on Rails(a friendly full-featured Rails admin panel) and from @jcsrb, who sent me recommendations to include in the newsletter.
👉 Justin Searls shared about the productivity gain from using Turbo and Stimulus:
👉 Greg Navis shared a Rails tip about how to test view logic in vanilla Rails:
👉 Vinicius Stock shared that the YJIT in Ruby 3.2 will provide performance improvements for Ruby LSP:
If you want to try Ruby LSP there is a VSCode extension: ruby-lsp. In case you want to use it with other editors Vinicius shared it should work with any editor supporting LSP spec:
For context:
Today Sorbet runs over Stripe’s entire Ruby codebase, currently amounting to over 15 million lines of code spread across 150,000 files.
👉 Nate Matykiewicz shared a piece of code to put on test.rb environment to do logging when running tests only when an environment variable is set:
👉 Kirill Shevchenko shared that Ruby also has fail as an alias for raise:
In case you are wondering when to use fail or raise, Zalom shared what Rubocop style guide is recommending:
Use `fail` to signal exceptions (not catching them)
Use `raise` to rethrow exceptions (catch them)
I recommend reading the discussion on Rubocop about raise and fail and read the article Jim Weirich on Exceptions on avdi.codes blog:
👉 Janko Marohnić shared a piece of code about setting up password pepper in Rodauth:
👉 Joel Drapper shared a code sample of original code and code generated by Phlex compiler:
👉 Andrzej Krzywda shared a thread about how to split Rails architecture between app layer and domain layer:
👉 Matt Swanson shared a code sample showing how to use tally:
👉 Noel Rappin shared that the new book he is working on Programming Ruby 3.2 is available in beta:
Noel shared an entire thread about what’s in the book, here is a preview:
You can buy the book here at The Pragmatic Bookshelf.
👉 Nishiki Liu asked for resources about learning to program lower level in Ruby:
Here are the recommended resources/paths:
workingwithruby.com (recommended by @siaw23)
speedshop newsletter (recommended by @cnorm35)
Read the docs for Karafka about threading (recommended by maciejmensfeld)
The book “Ruby under the microscope” (recommended by @fritzmeissner)
👉 Richard Schneeman asked a question about alternatives to default_scope:
Here are two concrete answers to this question:
"Named scopes and services" - @BijanRahnema
"create little methods (or something service objects) that wrap up more explicit scopes into something easier to wrangle" - @ektastrophe
It is also worth reading the discussion between David Cooperland and Richard Schneeman about onboarding new developers. Here is one of the things worth considering when onboarding new developers:
👉 Brandon Weaver asked about how to break up large models:
Here are some recommendations:
surrounded gem (recommended by @julian_rubisch)
The article 7 Patterns to Refactor Fat ActiveRecord Models (recommended by @joelquen)
This Github list of articles about Rails architecture (recommended by @fpsvogel)
Maintainable Rails (recommended by @ryanbigg)
“One thing I've done to split up a 'god model' is creating an 'alias table' in mysql (exact mirror of the old table), and adding columns to OldModel.ignored_columns one-by-one until you've created the boundary.” (recommended by @tiegz)
Refactoring a fat Rails Model article (recommended by @MikeChilson9)
Using Process Mapping to target your automation efforts (recommended by @mcInside)
👉 Adrian Marin published a new gem called class_variants:
👉 Kirill Shevchenko shared a code sample about __method__ and __callee__:
👉 Kateinoigakukun shared a code sample showing a minified code:
See the source code for the minifier here.
👉 Kirill Shevchenko shared a code sample showing how to run Rails and Sidekiq in the same process:
👉 Pascal Laliberté announced the release of their new project supercharts.dev:
👉 Chris Oliver asked about pain points when building Rails apps:
Here are some of the answers, but I suggest you read the entire conversation:
“Lack of passwordless solution: OmniAuth integrations, WebAuthN, Passkey and magic link bundled together” (@bradgessler)
"Simple" refactoring: like renaming classes/models and finding all associated references, moving classes into modules, renaming (instance) variables." (@marcoroth_)
"Rails is still painful to deploy compared with JS frameworks." (@madebyivor)
"Seamless editor support with type hints" (@strzibnyj)
"There’s way too much boilerplate for controllers, views, and partials. It makes it really difficult to build a basic CRUD app, esp as they become larger and more complex. It also makes it hard to plug external engines into Rails that ship with views." (@bradgessler)
"I think you should be able to disable the asset pipeline with a flag (besides the config)" (@thdaraujo)
"Scaling (but not infra, rather code / team)" (@katafrakt_pl)
"I wish I had an easy way to force myself to apply a specific scope. It should be the opposite of default_scope" (@dpaluy)
"upgrades .. lately I managed to upgrade a rails app from version 4 to 5.0 .. then went into gems compatibility issues." (@jobas6a)
"Configuring different environments. Setting up a pipeline etc." (@MyBuddyAndrew)
"Identify slow boot cause in larger apps as well as refresh slowdowns in development mode" (@adrienpoly)
"Rails is now built for existing rails developers. I feel it’s lost the ‘beginner friendliness’ it used to have. I tried to start rails dev again about 12 months ago and it was just too hard to piece it all together." (@LumSmith)
"The asset pipeline. So many damn problems with it. Even just adding an image to your site can break a deploy." (@fuzzygroup)
"Complex dynamic forms" (@jdisselhoff)
"Make it works on windows" (@Hihihihiu1)
"There's no business logic layer between controllers and models that lets you share code. So as your code base scales in size, there's a struggle to maintain things in a Rails-y way versus maintaining good conventions." (@danielrhodes)
"Testing story for Turbo / Hotwire is just “Capybara” - there should be a less brittle way to test those use cases." (@stephenprater)
👉 Greg Navis shared a Rails tip about using prepend_view_path:
👉 Eric Berry shared a thread about why RubyMine is a great IDE:
👉 Marco Roth shared they created a new gem called phlexing that can help with converting from ViewComponent to Phlex:
Mastodon accounts
Here are some accounts from Ruby community that you can find on Mastodon (left Twitter → right Mastodon):
Probably there are many more people now on Mastodon. Here is the public timeline for ruby.social or you can read the ruby tag or rails tag to see what people are sharing.
If you have read so far and you like the content, maybe you take into consideration sharing this and subscribing:
Related (but not Ruby-specific)
🧐 Brandon Weaver shared some developer salary data in SF and other major metros:
🧐 Julia Evans shared a nice drawing about writing tests when debugging:
🧐 Cezar Halmagean shared a thread about why learning to sell and market your skills as a developer are as important as learning to code:
Here is an excellent way to think about how to position yourself, but you should read the entire thread as it has nice ideas:
🧐 Nate Berkopec shared a quick tip to enable hash joins in Aurora MySQL:
🧐 Michael Feathers shared about how to choose what to test:
🧐 Gregory Szorc shared a new feature in Git 2.38
How to rebase stacked Git branches is a good article that goes to explain more about this feature and shows how to use it.
Articles and Videos
Courses/Books/Events
Michael Kohl shared that the Schedule for RubyConf Thailand 2022 has been published.
Joe Masilotti shared the new workshop they are launching the “Turbo Native workshop.” The tentative date is Thursday, December 15. Register here
Something to read
🗞 Newsletters
Joe Masilotti published a new edition of the Hotwire Dev Newsletter: October 2022 edition
Greg Molnar shared a new edition of This Week in Rails: More intuitive checking of form check boxes and radio buttons created by Wojciech Wnętrzak
Ruby Radar shared a new edition Ruby Radar #74 - Happy Halloween
🗞 Ruby Weekly shared a new edition 626 - The state of YJIT
🗞 Ruby LibHunt published a new edition of the Awesome Ruby Newsletter
✍🏾 Articles
Joel Drapper shared an article they wrote about Custom exception inheritance
Justearlin Ss shared an article they wrote about Building Passwordless Email Auth in Rails
Niklas Stephenson shared an article they published about how to use ShapeUp to empower the team: Empowered ShapeUp
David Copeland shared an article they wrote about How I Use Tachyons for CSS
Ayush shared an article about Testing controller concerns in Rails
Adrian Marin shared an article about How to plan a remote team retreat
Mike Perham shared an article about OpenSSL warns of critical security vulnerability with upcoming patch
Something to watch 🎥 or listen 🎧
🎥 Videos
🎥 Takashi Kokubun shared their talk at RubyKaigi about Ruby 4 JIT
🎥 Drifting Ruby shared the video version of This Week in Rails Oct 28th, 2022
🎥 The Rubber Duck Dev Show published a Halloween episode: The Halloween Party - Dev Horror Stories!
🎥 The Rubber Duck Dev Show also published the second episode of Coding with Chris - Goblin Grinder Part 1
🎧 Audio & Podcasts
🎧 The Ruby on Rails podcast published a new episode: Episode 441: The Pursuit of Mentorship with Meghan Gutshall
🎧 Ruby For All published a new episode about Writing Better Rails Tests with Jason Swett
🎧 Joel Quenneville shared a new episode of The BikeShed 359: Serializers with Chris Toomey
🎧 Remote Ruby published a new episode Development Workflows with Collin Jilbert
🧰 Gems, Libraries, and Updates
🧰 Hanami announced Hanami v.2.0.0.beta4 the last version before the final release. Read the article that describes the changes at Hanamirb.org
🧰 Avo published a new release of Avo Rails Admin. Read the release notes here or watch the video showing the main new features here. They also ask for feedback and ideas.
🧰 Chris Oliver announced a new version for prefixed_ids gem:
🧰 Josef Strzibny shared a new option for lightweight search: Sonic, written in Rust but with sonic-ruby gem for Ruby.
🧰 Mike Perham shared a new testing library: Maxitest = Minitest + all the features you always wanted:
🧰 Mike Perham announced the release of Sidekiq 7.0. Read about what’s new in Introducing Sidekiq 7.0 | Mike Perham, Sidekiq 7.0: Metrics and Sidekiq 7.0: Embedding
🧰 Rob Zolkos shared a gem they discovered about compressing JS: Terser
🧰 Kevin Newton shared a gem named actionview_precompiler: “This optimization aims to improve cold render times and to allow more memory to be shared via CoW on forking web servers.”
🧰 Julian Rubisch shared a gem that helps build onboarding flows in Rails app. Check out the abraham gem.
🧰 Lázaro Nixon shared they are working on a PR for Rails to introduce where.present and 2. See the Pull Request #46343
Reply