Short Ruby - edition #18

Briefly about everything happening in Ruby world

If you want a short excerpt of this newsletter, I created one here

This edition was created with support from @adrianthedev from Avo for Ruby on Rails (a friendly full-featured Rails admin panel), @jcsrb, and a lot of people that replied to my question about interesting resources about Ruby on Ruby.social, Twitter, r/ruby and Linkedin

πŸ‘‰ Ruby Lang released Ruby 3.2.0 Preview 3:

Here is how you can install it via ruby-install:

Added ruby-3.2.0-preview3 to the ruby-versions repository so ruby-install users should be able to safely install it and test the new features: $ ruby-install --latest ruby-3.2.0-preview3 #ruby #rubyinstall

πŸ‘‰ Justin Searls shared config to make VSCode go to definitions work inside Rails. Here are the steps:

πŸ‘‰ Stephen shared an advice for Ruby Devs joining Mastodon to contribute to Mastodon open source project:

Here you can find the list of resources marked fit for beginners

πŸ‘‰ Kirill Shevchenko shared about checking if Class includes a specific Module:

Four ways to check if a Class includes a specific Module: With Module methods include? included_modules ancestors Or using < operator

In case you want to read about Module#< read on official Ruby doc

Josh Cheek added a nice trick about including a module inside a class and still make the checks return false:

πŸ‘‰ Sebastian Wilgosz shared they plan to start a free weekly 1h group chat to junior/mid devs to answer questions about the following topics:

I'm considering launching free weekly 1-hour consults/chat/Q&A for anyone interested. Topics: #ruby @dry_rb @rom_rb @hanamirb and others. Anyone interested? (Thread πŸ‘‡)

If you want to participate please read the thread where Sebastian shares what he plans to do and if you are interested please contact Sebastian (find more contact options here)

πŸ‘‰ Avo shared a new release with a lot of features but also a lot of community contributions:

Hey everyone, Before we dive into this release, I want to thank all of you for making this community unique. This release has about 30 PRs added, and only 10 of them were issued by me. So, thanks for sharing the same amount of excitement I have for Avo. #rails #ruby

πŸ‘‰ Joel Drapper shared a short code sample about delegating an object method execution to a job:

This is pretty much the only job you’ll ever need.

Joel explained what this does:

Basically allows you to send any serialisable method to any serialisable object asynchronously.

πŸ‘‰ Peter Solnica shared how quick Hanami boots up:

Here's partial Hanami app booting and how fast it is in the real world. Heroku didn't even consider that something would start in less than 0.1s πŸ˜† #hanami

πŸ‘‰ Collin shared about using y method to inspect an object:

Well TIL about the `y` method from the Psych/Yaml library as another option to inspect an object:

πŸ‘‰ Jorge Manrubia shared about how they use concerns at 37Signals:

A common critique of Rails is that it encourages a poor separation of concerns. That when things get serious, you need an alternative that brings the missing pieces. We disagree. Vanilla Rails is plenty:

If you want to read more about this approach you can read comments on /r/rails or the replies to Jorge tweet where he shared this article.

It is also worth considering this quote from Taylor Otwell (Laravel creator):

πŸ‘‰ Joel Drapper shared a sample how the typical performance distribution in a Rails app:

There was a discussion with Nate Berkopec about what these metrics from APM actually measure:

But I think you should read the entire conversation as Joel shared more reports about how time is spent in a typical Rails app.

πŸ‘‰ Mehdi Farsi shared a code sample showing how to use Proc#=== with case statement:

πŸ‘‰ Dave Paola announced the start of a pilot program at Sierra Rails: fully managed junior engineer apprenticeship:

Today I'm announcing that Sierra Rails will begin piloting a FULLLY MANAGED junior engineer apprenticeship program. This program is designed to get junior engineers ramped up quickly, provide them ongoing technical coaching, and place them into your company as a productive team member that requires minimal management overhead. I'm amped about this and would love to talk to you if your organization would be interested in participating in the pilot.

πŸ‘‰ Rob Zolkos asked about what will be in Rails 8:

What do you think will be in Rails 8?

Here is some of the things people want to see in Rails 8:

  • β€œnon-devise user auth, a better request debug toolbar (a la Laravel), some form of standardized cron-like scheduling, some sort of tooling for legacy apps that makes it possible to see which instance variables are set but never used” - (@dpaola2)

  • β€œBuilt in Strada integration. Interactive console. More rails conductor stuff (web panel for metrics and web based invocation of rails commands), more authentication authorization primitives” (@BijanRahnema)

  • β€œWhat I want is View Component baked in with better support (fragment caching, block issues fixed)” (@rbates)

  • β€œActive Notifier, Action Cable Chat, Action Multi Tenant, Active Search, Action Webhook, Active Record Events, Active Record Trashable, Scaffold for authentication” (@lazaronixon)

  • β€œActionAuthentication, Propshaft asset management, new scaffold templates and customization options, various speed and quality of life enhancements extracted from Basecamp, Shopify and Hey.” (@ItsKentastic)

  • β€œAs few changes as possible (…) Need a period of consolidation as people migrate to/use/discover” (@alterisian)

πŸ‘‰ γ‚„γγ¨γ‚Šγ„ shared about the value Ruby is delivering in the community:

It's true that Ruby's popularity ranking is declining. But there are a lot of people using Ruby. The reasons are productivity, community, and money. A lot of companies are making money with Ruby. As long as Ruby is delivering value, we don't need to listen to the noise (which kindly says a lot). #rubyworld

πŸ‘‰ Matt Swanson shared a code sample about sorting Active Record models by enum values:

πŸ€Όβ€β™‚οΈ Sort ActiveRecord models by an enum value (in SQL!) using `in_order_of` Super handy to float results to the top of a list

πŸ‘‰ Dave Paola asked what we can do to increase the Ruby job market:

What is one thing we can do every day to increase the job market for ruby developers?

Here are some of the replies to this question:

  • β€œWork w/ bootcamps to tailor a curriculum using Ruby, teaching both JS and Hotwire in FE, and take students as interns for 3 to 6 months when they graduate” - (@LiliVerrot)

  • β€œKeep sharing how productive and enjoyable it is to program in Ruby (and Rails)!” (@ak_rails)

  • β€œStart new startups on rails” (@strzibnyj)

  • β€œShowcase how fast someone can build a product from ideation to production.” (@jamgar2020)

  • β€œMore of the companies using Ruby/Rails could do a better job of explaining how the business AND development process are so integral to their successes” (@learnactrepeat)

  • β€œFocus on the business folks, creating demand for devs. Sell benefits to decision makers.” (@learnactrepeat)

  • β€œTeach someone Ruby and show them how awesome it is” (@holger81)

  • β€œWhat we can do every day is to identify when #ruby can be used to solve a problem and share it” (@lucianghinda)

  • β€œStart more projects using Sinatra or Hanami or other frameworks. Wide the options possible in Ruby world.” (@lucianghinda)

  • β€œGet more people to build companies on Rails. There’s lots that could be improved in the framework to make it even more productive. I’ve noticed lately some important gems are feeling stale, like the OmniAuth ecosystem. And of course making Rails more welcoming to new people.” (@bradgessler)

πŸ‘‰ Ian shared they plan to start a weekly development session:

Ok, so I'm proposing a weekly development session ensemble / mob style on the #mastodon issues list. Lets start at 1800 CET 21st November... Join the Google Cal event for reminders!

Join the Google Cal event for reminders.

πŸ‘‰ Nick Sutterer shared a benchmark about Ruby methods with keyword arguments that are automatically merged:

Some benchmarks on Ruby methods with keyword arguments that are automatically merged (for example, into the next method call). If you provide that service, your method will be around 1/4 slower than without merging.

I run the script shared by Nick on my machine with Ruby 3.1.2 and here are the results:

πŸ‘‰ Justin Searls shared about relying on the lock file for gem versions and not specify them in the main Gemfile:

Rubyists: there are 0 good reasons to pin version specifiers in your Gemfile. Let's all agree to unilaterally disarm and stop adding them. Trust the lockfile. Pinning versions and ranges should be limited to cases where you know an upgraded version of the gem would break things.

πŸ‘‰  Trevor Turk shared how they document when the pin is really needed:

πŸ‘‰ Kirill Shevchenko shared about how to initialize hashes:

A hash is usually created using {} literal which is behaves equalentelly to Hash#new. However, with the second option, you can assign a default value for hash keys that don't exist, which can be useful for the same cases, for example:
Revived the Ruby benchmark server I implemented before as Ruby Grant at https://t.co/F9oIy1QxtQ. It's redesigned for sustainability since it's really hard to keep a benchmark server running. I'm sorry for the awful UI and choosing a conflicting project name :p

πŸ‘‰ Chris Seaton shared a key result from a paper analysing run-time call-site behaviors of Ruby applications:

A key result in Sophie's paper is that TruffleRuby's method call mechanisms effectively monomorphises the entire application - removing that cost of dynamic method lookup that people think Ruby inherently has. That's a breakthrough for Ruby performance.

Read the paper here and the article written by Stefan Marr here.

πŸ‘‰ Greg Navis shared a thread about Rack:

πŸ’‘ Ruby concept: Rack is a standardized interface for web apps Rack is the bridge between web servers (Puma, Webrick, Passanger) and actual web apps. Thanks to rack apps don't need to be integrated with each web server separately. ⬇️ Let's explore it in greater detail.

πŸ‘‰ Mike Perham shared a tip about scaling Sidekiq:

#Mastodon scaling pro tip: don’t set your #Sidekiq concurrency greater than 25. You will just slow things down. Instead, add more Sidekiq processes, up to one per CPU. Be sure you allocate enough database connections for that total concurrency.

πŸ‘‰ Joel Drapper shared they plan to work on supporting SVG, XML, RSS, ATOM and JSON views in Phex

From 0.5 Phlex::View will be renamed to Phlex::HTML. We’ll still call them β€œviews”, but this name change makes space for SVG, XML, RSS, ATOM and JSON views. #Phlex

πŸ‘‰ Stefan Wienert shared a project that is showing a browsable version of Rails changelog:

Recently I've published a Ruby on Rails Changelog explorer - Rails publishes the changes in various CHANGELOG.md, but it's hard to link back to the PR, and hard to follow up and scan it, so i've build a small static site that refreshes daily:

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)

Dave Paola shared about discussing bootcamps

One thing I find remarkable: unlike universities, most bootcamp graduates do not discuss very much which bootcamp they went to. They don't seem to be proud.

Maxime De Greve shared about new features at Github search:

Today, we're excited to launch @github code search - a new way to search and navigate code. We’re introducing a brand new search and code navigation view and they are jam packed with new features. Here are some I’m excited about.... 🧡 1/6

Gergely Orosz shared about how putting managers to work with too many people while also coding could be a recipe for failure:

Who would have thought that when you mandate engineering managers to do something that is unheard of in the tech industry - manage 20+ people AND spend at least 20% of your time coding - then all better managers head for the door. Because it’s now how eng management works.

Kent Beck shared about measuring and metrics we choose:

The Legibility Fallacy: influencing something you can easily measure is better than influencing something you can't easily measure.

Joe Masilotti shared how to fixup the first commit to a git repo:

TIL how to fixup the first commit to a git repo! 1. Stage your changes 2. git commit --fixup [SHA] 3. git rebase -i --root

Brandon Weaver asked about how to describe the role of a Principal Engineer:

How would you folks describe the role of a Principal Engineer?

Articles and Videos

Something to read

Newsletters

πŸ—žοΈ Ruby Weekly published a new edition 628: November 10, 202

πŸ—žοΈ Ruby LibHunt published a new edition of the Awesome Ruby Newsletter

✍🏾 Articles

Avi.Nyc shared a new article they wrote about Why Teach Ruby

Ruby Weekly shared an article on 37signals blog about Faster pagination in Hey

Mike Dalessio shared an article written by Stefan Marr about Classic Lookup Optimizations for Rails Apps

Something to watch πŸŽ₯ or listen 🎧

Videos

πŸŽ₯ Yaroslav Shmarov shared a new video where they create Ruby on Rails #95 hashtags and mentions

Audio & Podcasts

🎧 Ruby For All published a new episode about Attending Conferences 101

Gems, Libraries, and Updates

🧰 Tobias Ahlin shared Mona Sans & Hubot Sans fonts released by Github.

🧰 Postmodern shared they released a new version of ruby-nmap. Read the changelog here

🧰 Marco Roth shared a great tool to convert from SQL to Arel: scuttle.io

🧰 Yaroslav Shmarov shared a gem passwordless that is helping with with implementing magic link authentication.

🧰 Postmodern shared Gel - a modern gem manager - a possible replacement for bundler.

🧰 John Hawthorn shared that bundler switched it’s version resolution algorithm making bundler update faster. Check the PR that was merged here. He also shared a link to an article that explains the algorithm used: PubGrub: Next-Generation Version Solving

🧰 Garrett Dimon shared a library that transpiles Ruby to Javascript: Ruby2JS:

Ruby2JS is an extensible Ruby to modern JavaScript transpiler you can use in production today.

🧰 Dmitry Rybakov shared a new release of Mondoid (the  Object-Document Mapper framework for MongoDB in Ruby ): Mongoid 7.5.2 released

🧰 Meesterfox shared a new testing gem looks-good:

A visual RSpec matcher to ensure the entire page (or specific elements) have not changed. Allows for a tolerance to be set, so you can reuire pixel-perfect or allow for some minor changes.

🧰 Nejdet Kadir announced he created a new gem dry-validation-rails to help validating models in Rails with dry-validation. Here is a code sample shared by Nedjet:

Reply

or to participate.