π Short Ruby News - Edition #43
Discover the world of Ruby in this comprehensive newsletter covering week 20 of 2023. Find code samples, community updates, gems, resources, and thought-provoking discussions.
You can jump directly to a section:
π Our Community
πΒ All about Code and Ruby
π§°Β Gems, Libraries, and Updates
π€Β Related (but not Ruby-specific)
More content: π π π§ π₯ βπΎ (articles, podcasts, videos, newsletters, and books).
The newsletter is now back to one single email sent. Read here more about this decision. TLDR: both the poll results and the stats from the newsletter show that the two newsletter format was not working correctly, while the majority prefers one email. Thus this edition contains the More Content section inside this edition as before. I will continue to publish the expanded content edition only on the web.
All images are clickable. You can click on the image if you want to read the original source (article, tweet, videoβ¦).
πΈ For only $1.5 per week (just $6.5 a month), you can become a paid subscriber and contribute to the success of the flourishing Ruby community we all adore!
π Our Community
π Friendly.RbΒ announced a new speaker, see friendlyrb.com for more details

π Dave CopelandΒ shared reasons why Rails and Ruby are great:

And here are what other people added:


π Ruby For GoodΒ announcedΒ that registrations are open for the event in July at rubyforgood.org/events

π IanΒ announced an update for the Β alterisian.github.io/helloworld website:

π Dave PaolaΒ shared feedback from a recent applicant:

Here are some of the replies:





There are many replies to Dave's tweet that I recommend you read.
π On the same topic, GomezΒ shared about how they use Ruby on Rails at PlanetScale:

π All about Code and Ruby
π wiki.nikiv.dev/programming-languages/ruby is an extensive wiki created by Nikita with many resources for learning or deep diving into Ruby. Here is a screenshot with just a tiny part of all the resources:
There is a similar wiki about Rails maintained by the same author.
π Noah GibbsΒ shared about code and the choices we have to make between them.

This triggered a lot of replies. Please read them directly, as there is a good but healthy debate.
Here are just some of the replies in a random order. This seems to me a sensible topic for our community, so please read the other replies for context:






Other links mentioned in the replies: GoodCop and Relaxed Ruby Style.
π Paul MucurΒ shared a TIL aboutΒ create_or_find_by:

π Ben Sheldon (He/Him)Β shared two learning points about Regexp and a code sample showing Ruby 3.2 Regexp timeout:

πBenoitΒ sharedΒ a code sample showing how to display PSQL style tables in Rails console. Check the gist at PSQL table in Rails console

π Brandon WeaverΒ asked a question about reducing the processing of requests for assets by Webmock with VCR:

Olivier LacanΒ replied with the link toΒ Ignore Request for VCR. You might also want to read the analysis Brandon WeaverΒ added in this issue opened on webmock gem: Performance of `WebMock::Util::Headers.normalize_headers` Β· Issue #1027
πKay RhodesΒ shared a tip about how to fix a MySQL gem error:

π Takashi KokubunΒ shared what the current purpose of RJIT is:

π Prabin PoudelΒ shared about deployment options:

Among the replies:
π Ruby CademyΒ shared a code sample showing how to use Object#tap (that Ruby 3.2 seems to be defined at Kernel#tap vs in Ruby 2.7 being at Object#tap):

πAlexandre RubanΒ asked a question about SRP on an Active Model has over 70 attributes:

Matt SwansonΒ replied with:

π Brad GesslerΒ shared a code sample showing a form builder:

π Adrian MarinΒ asked a question about integration StimulusReflex with Hotwire:

Marco RothΒ clarified this:

πAhmedΒ shared a code sample showing how to use metaprogramming to define methods:

π Xavier NoriaΒ shared a code sample about the break keyword used in loops:

π Josef StrzibnyΒ shared a thread with gems recommendations:

Here are the recommended gems:
vessel - βhigh-level web crawling frameworkβ
mapkick - βCreate beautiful JavaScript maps with one line of Ruby. No more fighting with mapping librariesβ
simple_calendar - βSimple Calendar is designed to do one thing well: render a calendarβ
business_time - business hours math
heya - βHeya is a campaign mailer for Rails. Think of it like ActionMailer, but for timed email sequences. It can also perform other actions like sending a text messageβ
noticed - βNotifications for your Ruby on Rails appβ
chartkick - βCreate beautiful JavaScript charts with one line of Rubyβ
blind_index - βSecurely search encrypted database fieldsβ
split - βSplit is a rack based A/B testing framework designed to work with Rails, Sinatra or any other rack based appβ
store_attribute - βActiveRecord extension which adds typecasting to store accessorsβ
logidze - βLogidze provides tools for logging DB records changes when using PostgreSQLβ
discard - βSoft deletes for ActiveRecord done rightβ
counter_culture - βTurbo-charged counter caches for your Rails appβ
pretender - βAs an admin, there are times you want to see exactly what another user seesβ
secure_headers - βThe gem will automatically apply several headers that are related to securityβ
ahoy - βSimple, powerful, first-party analytics for Railsβ
blazer - βExplore your data with SQL. Easily create charts and dashboards, and share them with your teamβ
i18n-tasks - βi18n-tasks helps you find and manage missing and unused translationsβ
instant18n - βUse OpenAI's GPT large-language model to power internationalization of the text in your Rails applicationβ
jsonb_accessor - βAdds typed jsonb backed fields as first class citizens to your ActiveRecord modelsβ
invoice_printer - βSuper simple PDF invoicing.Β InvoicePrinter is a server, command line program and pure Ruby library to generate PDF invoices in no time. You can use Ruby or JSON as the invoice representation to build the final PDFβ
π Brad GesslerΒ shared a thread about batch resource manipulation. Here are the first two tweets from the thread:


π CraigΒ shared a list of shortcuts they use when programming in Rails:

πColleen SchnettlerΒ asked for recommendations of Rails CMS:

Here are some of the recommendations:
Sitepress (Ruby)
Bridgetown (Ruby)
Avo (Ruby)
AlchemyCMS (Ruby)
Middleman (Ruby) - check out also this repo for Middleman 4 + Tailwind CSS
Jekyll (Ruby)
SpinalCMS (Ruby)
π Ruby CademyΒ shared a code sample about using Rails ActiveSupport::CurrentAttributes

π Xavier NoriaΒ shared a thread about βreloadingβ naming:

He explain further about what happens in Ruby:
That indeed happens if you have reloading and eager loading enabled, a possible but rare combination.
In the app lazy loads, "reloading" only "unloads", really. That is the nuance. Unloaded classes are not loaded again during that operation.
You'll load what you use, on demand.
"Unloading" is also an abuse of language: Ruby has no way to unload code.
"Unloading" means `remove_const` autoloaded constants.
However, if the app is correct, the objects they stored will become unreachable and eventually GCed.
So, in that sense, this one is good enough.
π€ I imagine that if you have read this so far, you find value in this newsletter.
π§° Gems, Libraries, and Updates
π§° Dmitry TsepelevΒ announced a new gemΒ rubocop_director: Plan your refactorings properly
π§° Dima FatkoΒ announced a new gemΒ pluck_in_batches: A faster alternative to the custom use of `in_batches` with `pluck`

π§° Nick SchwadererΒ announced a new gemΒ chat_gpt_error_handler:
π§° Okura MasafumiΒ launched a new gemΒ okuramasafumi/niwa: New, Integrated, Working Annotations

π§° Mike DalessioΒ announced the release of version 1.15.0 of nokogiriΒ Read the release notes
π§° Mike DalessioΒ announced the release of version 1.6.3 of the sqlite3-ruby gemΒ Read the release notes
π§° PaweΕ UrbanekΒ published a new gemΒ rails-brotli-cache: Rails cache using Brotli algorithm offers better compression and performance
π§° Yuta SaitoΒ announced they release version 2.0.0 of ruby.wasmΒ Read release notes
π§° Ivo Herweijer published a new benchmark for Roda that now includes Ruby 3.3 preview1:

π§° Atsushi Tatsuma published a new gem llama_cpp - provides Ruby bindings for the llama.cpp
Please consider becoming a paid subscriber to support this newsletter for just $1.5/week ($6.5/month). Your contribution aids growth and maintains the quality of ShortRuby for everybody:
If you consider upgrading and want more information, please read Why to subscribe to paid
π€ Related (but not Ruby-specific)
π€ BenoitΒ shared an SQL to simulate a slow SQL update in PostgreSQL:

π€ Nate BerkopecΒ shared a reminder to check resources if they are over provisioned:

π€ Chris WanstrathΒ shared a thread about the early days of Github and keeping it profitable:

More content: π π π§ π₯ βπΎ
In case you want to read the More Content version with articles previews read it on web here
π Books
π Noel RappinΒ announced thatΒ Programming Ruby 3.2 (5th Edition) is now draft-complete
π Newsletters
ποΈΒ Ruby WeeklyΒ published a new edition:Β Ruby 3.3 makes its first appearance
πVipul A MΒ published a new edition ofΒ This Week in Rails about Rails World CFP, ActiveRecord.disconnect_all!, optimized where query and more!
π Greg MolnarΒ published a new edition of Rails TricksΒ about Shared examples with Minitest - Rails Tricks Issue 7
ποΈΒ Ruby Libhunt published a new edition of Awesome Ruby Newsletter - Issue 365
ποΈ Ruby Radar published a new edition about Spilling Beans
π§ Podcasts
π§Rooftop RubyΒ published a new episode about 13: Open Source and More With Marco Roth
π§Code And The Coding Coders Who Code ItΒ published a new episode aboutΒ Episode 21 - Nick Schwaderer
π§ Indie RailsΒ published a new episode aboutΒ Pascal LalibertΓ© - 6 things to avoid as a freelancer
π§ Remote RubyΒ published a new episode aboutΒ Railsconf Recap | Remote Ruby | Episode 229
π§ Ruby RoguesΒ published an episode with Brad Gessler about Building Rails Application with Phlex
π½οΈ π₯ Videos
Talks
π½οΈ Yaroslav ShmarovΒ published their first episode of SupeChatΒ Amanda Perino from Rails Foundation about Rails World
π½οΈ The Rubber Duck Dev ShowΒ published a new episode aboutΒ Leveling Up For Juniors With CodeWithJulie
Screencasts
π₯ Yaroslav ShmarovΒ published a new episode aboutΒ Rails 7 #133 API Pagination with Pagy
π₯ Dave KimuraΒ published a new episode aboutΒ Tokenized Search
π₯ DeaninΒ published new episodes about:
βπΎ Articles
Whatβs new
Samuel WilliamsΒ shared their slides from Ruby Conf AU: Asynchronous Rails
Big BinaryΒ published an article aboutΒ Rails 7.1 adds ActiveRecord::Base::normalizes. On the same topic Sampat BadheΒ also published an article aboutΒ Rails 7.1 AR adds normalizes API for attribute values
Shivam Singh ChaharΒ published an article aboutΒ Rails 7.1 adds support for responsive images.
How-Tos
MaurΓcio MaiaΒ published an articleΒ How-To Add Recommendations to a Rails App with pgvector and OpenAI
Aestimo Kirina published an article aboutΒ Manage Your Ruby Logs Like a Pro
Akshay Khot published an article about How to Create Custom Flash Types in Rails
Adam RiceΒ published an article aboutΒ Debugging with introspection
Takashi KokubunΒ published an article aboutΒ their talk at RubyKaigi about [JP] Announced how to write a JIT compiler on RubyKaigi (English version translated with Google)
Ariel Juodziukynas published an article about Handling Environment Variables in Ruby
Deep Dives
Unathi Chonco published an article about Ruby Method Lookup Demystified: Inheritance, Mixins, and Super
PaweΕ DΔ browskiΒ published an article aboutΒ Unraveling the mystery of the super keyword
Related
Adam RiceΒ published an article aboutΒ Why you shouldn't exclusively hire senior developers
Dave CopelandΒ shared an article aboutΒ My 20 Year Career is Technical Debt or Deprecated
PaweΕ DΔ browskiΒ published an article aboutΒ Understanding database Indexes in PostgreSQL
Jeremy SmithΒ shared an repository aboutΒ prompt-engineering: Tips and tricks for working with Large Language Models like OpenAI's GPT-4
Lucas BarretΒ published an article aboutΒ Postgres concurrency what could go wrong (part 1)
Please consider becoming a paid subscriber to support this newsletter for just $1.5/week ($6.5/month). Your contribution aids growth and maintains the quality of ShortRuby for everybody:
If you consider upgrading and want more information, please read Why to subscribe to paid