The In-Depth Guide to Active Record's load_async in Rails 7— Concurrency has been a hot topic in the Ruby and Rails space for a while now (especially now we have fibers, ractors, and more at our disposal) and Rails 7 has added another tool to run ActiveRecord queries in the background. But, before you start ‘asyncing all the things’, there are considerations and careful testing to think about. And it must be good, since the creator of load_async even said: “I must concur that this article is excellent, it’s better explained than I could do myself”. Paweł Urbanek |
A Look at Ruby's Fiber Scheduler Functionality— Added in Ruby 3.0, the Fiber Scheduler interface opens up a nice approach for working with asynchronous operations using standard Ruby methods (no frameworks needed), making parallel operations even simpler and gem dependency-free. Bruno Sutic |
![]() Free eBook: Efficient Search in Rails with Postgres— In this eBook, Leigh Halliday explains how to speed up a search query from seconds to milliseconds — walking through using exact matches, similarity matches with trigrams, partial matches with ILIKE, and natural language matches. pganalyze sponsor |
Ruby Fibers 101— Fibers (introduced way back in Ruby 1.9) are now getting some much-deserved extra attention due to the Fiber::SchedulerInterface released in 3.0 – this post provides another look in addition to the post already linked above. Swaathi Kakarla |
RubyConf 2021: The Talks You Might Have Missed— RubyConf 2021 took place in Denver late last year and while we’ve linked to a few talks, Shopify has put together a list of summaries and links to interesting talks given by their engineers. Jennie Lundrigan |
Thredded 1.0: A Forum Engine for Rails Apps— We first linked to this project 6 years ago but it has now finally hit 1.0 and added Rails 7 and Ruby 3 support. It’s a message board system that works as an engine so you can run it standalone or as part of an existing Rails app, if needed. GitHub repo. Mazovetskiy, Oliveira, et al. |
WahWah 1.3: A Library for Reading Audio Metadata— For reading things like MP3 IDv3 tags, embedded images, and similar metadata in formats including MP3, M4A, OGG, OGA, OPUS, WAV, FLAC, etc. Pure Ruby too, with no dependencies. Aidewoode |
Avoiding (potential) malicious activity with binstubs In the most recent tip, we learned more about binstubs, and specifically, adding to our $PATH variable so that we don't need to run bin/<some_executable> from a repo and can instead run <some_executable> from a repo. A few folks wrote to us in response to this tip, and correctly said that it only works if you are always in trusted repositories. Why? A malicious repository could put an executable in the bin directory that overwrites a command we use commonly. For instance, an executable at bin/ls . If we've now set our $PATH variable such that we no longer need to specify bin , then simply running ls may execute whatever malicious code could be in bin/ls . Why might we have malicious code locally though? Sometimes we clone repos to debug them, sometimes we cd into directories of gems that we don't know everything about, or anything else. We can still solve for this though! As a reader referenced, this article gives us a clever solution. We can keep all of our trusted repositories in one directory. Then, in that directory, we can make a .git/safe directory (mkdir .git/safe ). Then, if we add .git/safe/../../bin to our $PATH , we will only be able to execute any executables in the bin directories in repositories we trust! Thanks again for feedback on my last tip! |
|
|