---
title: "Ruby 3.0.1 released"
publication: "Ruby Weekly"
issue: 547
published_at: "2021-04-08"
canonical_url: "https://rubyweekly.com/issues/547"
---

Plus ways to fix N+1 queries, and a little IRB trick. |        

#547 — April 8, 2021 

[Read on the Web](https://rubyweekly.com/issues/<!--%20%5Cid%20-->)    

Ruby Weekly 

[![\](https://res.cloudinary.com/cpress/image/upload/w_1280,e_sharpen:60/k0yrjz9ftswcbpbsispb.jpg)](https://www.ruby-lang.org/en/news/2021/04/05/ruby-3-0-1-released/)   

[Ruby 3.0.1 Released](https://www.ruby-lang.org/en/news/2021/04/05/ruby-3-0-1-released/) — A quick point release to fix two vulnerabilities: a [XML round-trip vulnerability in REXML](https://www.ruby-lang.org/en/news/2021/04/05/xml-round-trip-vulnerability-in-rexml-cve-2021-28965/) and [a file creation vulnerability in `tempfile`](https://www.ruby-lang.org/en/news/2021/04/05/tempfile-path-traversal-on-windows-cve-2021-28966/) on Windows. [Ruby 2.7.3](https://www.ruby-lang.org/en/news/2021/04/05/ruby-2-7-3-released/), [2.6.7](https://www.ruby-lang.org/en/news/2021/04/05/ruby-2-6-7-released/) and [2.5.9](https://www.ruby-lang.org/en/news/2021/04/05/ruby-2-5-9-released/) have also been released to fix these and other issues. 

Yui Naruse and the Ruby Core Team   

[An Interview with Jeremy Evans](https://evrone.com/jeremy-evans-interview) — Jeremy is best known as the creator of [Sequel](https://sequel.jeremyevans.net/), the Ruby database library, as well as Roda, and for maintaining the Ruby ports for OpenBSD. Here he shares his thoughts on where Roda trumps Rails and what features he’d remove from Ruby if he could. 

Evrone   [![\](https://copm.s3.amazonaws.com/e754595a.png)](https://dashboard.redisgreen.net/rubyweekly) 

[Redis 6.2 on RedisGreen](https://dashboard.redisgreen.net/rubyweekly) — SSL encryption, key size tracking, memory mapping, online upgrades, and more. 

RedisGreen sponsor    

▶[YJIT: Building a New JIT Compiler Inside CRuby](https://www.youtube.com/watch?v=vucLAqv7qpc) — A technical talk on the optimization challenges Ruby presents, how a JIT can help, and specific details about the YJIT (Yet Another Ruby JIT), a JIT project being worked on at Shopify by Maxime, Alan Wu, and Aaron ‘tenderlove’ Patterson. 

Maxime Chevalier-Boisvert   

[RubyMine 2021.1 Released](https://blog.jetbrains.com/ruby/2021/04/rubymine-2021-1-released/) — The popular (though commercial) IDE gets a key update with added Ruby 3 and RBS support, improved code completion (from the [RBS type signatures](https://github.com/ruby/rbs)), and integration with a new collaborative development system JetBrains has released. 

Nataliia Kudanova     

Quick Bits 

- Two weeks ago we mentioned the release of [Crystal 1.0](https://crystal-lang.org/2021/03/22/crystal-1.0-what-to-expect.html), a compiled Ruby-inspired language, but just how fast is it? [Very fast indeed](https://twitter.com/sdogruyol/status/1377918360344743936) but, and it's worth stressing this, it _isn't_ Ruby even if it looks similar.
- Somehow we missed this April Fool's joke, but it was proposed that rather than having rightward assignments like in Ruby 3.0, maybe we could try [downwards assignments](https://bugs.ruby-lang.org/issues/17768) instead? :-) I'm not going to lie.. I like this in a warped kinda way.  

💻 Jobs  

[Sr. Ruby Engineer at Propelor (Est Time Zone +/- 3 Hrs, Remote)](https://www.linkedin.com/jobs/view/2255010679/) — Interested in Fintech? Join our core team building the AI that will level the playing field for self-directed investors. 

Propelor   

[Staff Rails Engineer-Denver or Remote](https://ibotta.ruutly.com/job/2962549) — Ibotta is looking for a Staff Rails Engineer to work on the platform that powers our app that is used by millions of consumers. 

Ibotta   

[Find Ruby Jobs with Hired](https://hired.com/join/?utm_source=newsletter&utm_medium=sponsor&utm_campaign=%28b2c%29%28l-all%29%28r-all%29%28cooper-rubyweekly%29&utm_content=find-your-next-job) — Take 5 minutes to build your free profile & start getting interviews for your next job. Companies on Hired are actively hiring right now. 

Hired  

📘 Articles & Tutorials  

[Four Non-Standard Ways to Fix N+1 Queries in Rails](https://pawelurbanek.com/rails-n-1-queries) — Love this bit: _“To make up for the cliché topic, I’ll describe less common solutions to this problem.”_ Pawel looks at some approaches to reduce the number of cascading queries without using includes or additional table join operations. 

Paweł Urbanek   

[Building Real-Time Command Line Applications with Action Cable and Thor](https://hschne.at/2021/04/04/build-real-time-clis-with-actioncable.html) — Action Cable is great for adding real-time functionality to Rails apps, but did you know you can leverage it from the command line? A neat bit of experimentation at play here. 

Hans-Jörg Schnedlitz   

[Why and How to Host your Rails 6 App with AWS ElasticBeanstalk and RDS](https://www.honeybadger.io/blog/rails-6-aws-elastic-beanstalk/?utm_source=rubyweekly&utm_medium=email&utm_campaign=ruby) — From the Honeybadger Developer Blog. When errors strike, Honeybadger’s monitoring service has your back to defeat them ⚔️ 

Honeybadger sponsor   

[Ruby 3.1 Adds `Enumerable#compact` and `Enumerator::Lazy#compact`](https://bigbinary.com/blog/ruby-3-1-adds-enumerable-compact) — You’re probably familiar with `Array`’s `compact` method for removing `nil` elements, but now the same idea is being extended to enumerables and lazy enumerators. 

Ashik Salman   

▶[How to Use Stripe Checkout in Rails](https://gorails.com/episodes/stripe-checkout-rails) — Learn how to accept payments in your Rails app with Stripe Checkout using the [Pay gem](https://github.com/pay-rails/pay). 

Go Rails   

[How to Set Up Tailwind CSS JIT in a Rails Project to Compile Styles 20x Faster](https://evilmartians.com/chronicles/set-up-tailwind-css-jit-in-a-rails-project-to-compile-styles-20x-faster) — Leans on the JIT compiler that rolled out with this week’s [Tailwind CSS 2.1 release](https://github.com/tailwindlabs/tailwindcss/releases/tag/v2.1.0). 

Vladimir Dementyev   

[Building a DSL with Ruby](https://longliveruby.com/articles/building-dsl-with-ruby) — A look at a handful of Ruby based DSLs you might use on a frequent basis and then the basics of how such things are implemented. 

Paweł Dąbrowski   

[Kubernetes Single Sign On: A Detailed Guide](http://www.talkingquickly.co.uk/kubernetes-sso-a-detailed-guide) — How to set up a group based SSO system for Kubernetes including the `kubectl` CLI, any web app with ingress, a Docker registry and gitea. 

Ben Dixon   

[HTTP Caching in Rails Apps](https://www.honeybadger.io/blog/http-caching-ruby-rails/) — _“The fastest web page is one you’ve already loaded.”_ 

Jonathan Miles   

[The Six Characters That Could Bring Down Your Rails App](https://www.moncefbelyamani.com/the-6-characters-that-could-bring-down-your-rails-app/) — Spoiler alert: It’s `.count` – I’m surprised it was so slow in their case, though, but a story is a story and they found a worthwhile fix. 

Moncef Belyamani  

🛠 Code and Tools  

[Mechanize 2.8: A Library for Automated Web Interaction](https://github.com/sparklemotion/mechanize) — Automatically stores and sends cookies, follows redirects, and can follow links and submit forms, etc. Now needs Ruby 2.5 or newer. 

Sparkle Motion   

[Clayoven: A Site Generator Aimed at Math-Heavy Sites](https://github.com/artagnon/clayoven) — A curiously specific static site generator. Only 500 lines and, if you can understand it, certainly puts out good looking [pages packed with math and diagrams](https://artagnon.com/math/category/7). 

Ramkumar Ramachandra   

[Application Dependencies Outdated? We Can Help](https://www.upgraderails.com) 

Hint sponsor   

[Avo 1.0: A Ruby on Rails Admin System](https://avohq.io/blog/avo-v1) — More about how it works in [the documentation](https://docs.avohq.io/1.0/). Note that it’s only free for personal use and commercial otherwise, but the end results do look nice. 

AvoHQ   

[InvoicePrinter 2.1: A Pure Ruby Invoice PDF Library](https://nts.strzibny.name/invoiceprinter-2.1/) — It now supports Ruby 3. 

Josef Strzibny   

[Passenger 6.0.8: The Ruby (and More) App Server](https://blog.phusion.nl/2021/04/01/passenger-6-0-8/) 

Phusion Blog   

[ValidatesTimeliness 5.0: Date and Time Validation for ActiveModel and Rails](https://github.com/adzap/validates_timeliness) 

Adam Meehan      

💡**Tip of the Week** 

Eval History in IRB   

Often, when working in an IRB console, I'll realize only after running a command that I didn't store the result in a variable but I'd like to access it. Thankfully, IRB has `_` to allow us to access our previous result: 

```
irb> some.expensive_method
=> :some_result

# We can access the result without having
# to re-run the expensive method using _
irb> variable_to_store_result = _
=> :some_result
``` 

But did you know IRB also gives us the ability to access evaluations _prior_ to the most recent one? 

We have to configure this ability explicitly by setting `IRB.conf[:EVAL_HISTORY]` to the number of results we'd like to store. We can add this snippet to our `~/.irbrc` file and it will apply to every IRB console we open: 

```
# This will allow us to access our previous
# 3 evaluations in an IRB console
IRB.conf[:EVAL_HISTORY] = 3
``` 

Or, you can run this code within an _already running_ IRB context: 

```
IRB::CurrentContext().eval_history = 3
``` 

And then, once we've configured our eval history, we can access previous evaluations like this: 

```
irb> this = "is just to demonstrate"
irb> how = :useful
irb> this_command = :can_be

# We'll see IRB.conf[:EVAL_HISTORY] number
# of the most recent results we've gotten
# if we use __
irb> __
=>
1 "is just to demonstrate"
2 :useful
3 :can_be

# And we can access them by index
> __[2]
=> :useful

# And even store them as variables
> some_var = __[3]
=> :can_be
``` 

_Note: In case it's not clear, this feature uses a **double** underscore rather than a single one._ 

Hopefully this saves a little re-running of commands in IRB to store evaluations.    

This week’s tip was written by [Jemma Issroff](https://twitter.com/jemmaissroff).          

Curated by [Peter Cooper](https://twitter.com/peterc), [Glenn Goodrich](https://twitter.com/ruprict) and [Cooperpress](https://cooperpress.com/). 

[Change your email address](https://rubyweekly.com/edit_subscription/*|UID|*) or[Stop getting this newsletter](https://rubyweekly.com/leave/*|UID|*) 

© Cooper Press Ltd · Fairfield Enterprise Centre, Louth, LN11 0LS, United Kingdom
