🧐 Issue #13 - 03 - 09 October 2022
The one where we share our love of Ruby and Rails
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.
👉 Jason Charnes asked what excites people about Ruby on Rails in 2022:
Here are some answers:
“The community. To be more specific the freshness and joy of Ruby 3 and Rails 7 that I think is fueling an excitement of the community and a desire to attract new people in the community” (@lucianghinda)
“Hotwire. Wish Rails would offer a PWA solution out of the box.” (@th1agofm)
“Alternative ruby frameworks to Rails. Which ironically strengthens the rails and Ruby a lot.” (@kowfm)
“The error reporter interface became more mature and adoptions are increasing” (@_st0012)
“Rails 7 changing the game and getting us back to our roots. It has me so dang excited. Not just what hotwire delivered but a renewed excitement in the framework and the fundamentals that made us love it in the beginning.
I love writing rails so much” (@schwad_rb)
“Hotwire! One codebase, instead of Rails API + gigantic pile of JS. I can maintain a Rails+Hotwire app myself, much harder to maintain both Rails API and React frontend by myself” (@aidanhmiles)
“Feels like anyone can become a one man coding machine with Hotwire. I wasn’t even doing frontend until Hotwire. Didn’t have the interest before then because I found it a nightmare. Now, it’s the most fun I have had in years!!” (@mhenrixon)
“That my lack of interest in learning a lot about React in recent years...might be paying off.” (@robbyrussell)
“For me it’s the basics. That it’s a solid platform with a good, supportive community that makes it easy to build cool things!” (@rose_w)
“Particularly for prototyping a new app for feature, it's still the best way to do it by a significant amount. That's still, to me, the big problem Rails solves very well that nobody else is really trying to solve.” (@codefolio)
“the additional focus from the community on helping juniors, learning and teaching ❤️, things like new podcasts, courses, newsletters etc.” (@afomera)
“Just how easy it is now to build high-fidelity user experiences in Rails with Hotwire, custom Turbo Stream actions and the myriad of possibilities they enable, CableReady::Updatable, etc.” (@danieldopence)
There are a lot more anwers. You should read all the replies.
👉 Postmodern shared that pdfkit-0.8.7 still has the problem described in CVE 2022-25765:
To check if you have this issue:
👉 Postmodern asked a question about difference between accessing ENV variables:
In case you are wondering how does ENV behave when using with fetch or access through :
And it seems the reason Rubocop suggest this change is to make the default value implicit.
👉 David shared a code sample about setting order with condition in Rails:
👉 Greg Navis shared a code sample about marking active models as read only:
👉 Akshay shared in thread the difference between class_eval and instance_eval in Ruby:
👉 Kirill Shevchenko shared a code sample showing how reverse_each works in Ruby:
👉 David shared a comparison between dom_id and turbo_frame_tag:
👉 Thiago Massa shared a code sample of using pattern matching in Ruby 3.1:
👉 Joel Drapper shared a code sample about a new feature coming soon in Phlex, helping defining collection views:
You can see mode Phlex code samples here, here and here. You can also browse a list of open source projects using Phlex at here.
👉 Greg Navis shared a code sample about how to disable lazy loading on individual instances of Active Record:
👉 Brad Gessler shared a code sample for getting all Rails tag helpers work with Phlex:
👉 Olatunbosun shared a code sample showing how to use pattern matching to DRY controller code:
Read the tweet, as there are more examples there.
👉 Adrian Marin shared a thread about how to think about Rails transitioning from Sprockets to today:
👉 Samuel Williams shared a preview of a VScode extension - Sus Test Provider - that would provide real-time feedback when tests failed and the reason based on the sus - test framework:
👉 Thiago Massa shared a sample code about Ruby safe navigation operator and dig:
Bradley Schaefer replied with a piece of code showing a null object pattern for nested hashes:
👉 Greg Navis shared a Rails code sample about using some Active Record methods:
👉 Kirill Shevchenko shared a code sample about debugging memory issues in Ruby:
Joshn Cheek shared a piece of code that will show the source code and line number from where that objects was defined (the code can be found in this gist or a version that will also show the class name along with source code here):
👉 Jacob Daddario asked a question about organising code in a Rails app:
Here are some answers from the replies, but I invite you to read them all as people share a lot of knowledge about what works and does not work for them and why:
On the same note, Jason Swett shared a twitter thread about code organisation:
To organize ALL files by type is to take what was a good idea at a certain level and apply it way beyond what makes sense.
What good could it possibly do to have all your factories in one folder, for example? What meaning or utility could that have?
Don't organize your Rails code by design pattern. Organize it by meaning.
👉 Peter Solnica shared they are playing with a new library codename dry-operation
👉 Thiago Massa shared a tweet about checking if a value if empty/nil/blank in Ruby on Rails:
👉 Akshay shared about the difference between proc and lamba when thinking about return:
👉 Kevin Newton shared about the possibilities Ruby allows to define a class under a class that is inside a variable:
👉 Kirill Shevchenko shared a code sample to daemonize a Ruby script:
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)
🧐 Thiago Massa shared a useful terminal command: using !! to get the last command
🧐 Schwad shared a sample code for deleting all branches and keeping the main:
Mathieu Jobin replied with their Github repo named git-scripts containing a list of helpful scripts when working with git.
🧐 Xavier Noria shared a perspective about how meetings trigger “improvised action”:
🧐 Brandon Weaver shared a nice tweet about what to focus when hiring:
He also added:
Code is only hard because we don't talk to each other nearly enough, and assume that there's a technical solution to every problem.
🧐 Wisen Tanasa shared a thread about TDD and how to think about it:
Here is one of tweets in this thread:
🧐 Scott Hanselman shared a story about a friend dropping the production DB and it got some amazing replies with cool stories to read. It can happen to anyone:
🧐 Julie asked as question about how to teach kids how to code:
There a lot of good answers in the replies that I invite you to read.
Articles and Videos
Bridgetown launched the announcement for BridgetownConf 2022, happening on 7 November 2022; it will be online and free. BridgetownConf 2022: Save the Date!
Julian Rubisch shared a preview of their new book Advanced CableReady. Get it on Gumroad
Cezar Halmagean launched a new course: Learn Hotwire - The #1 Feature in Ruby on Rails 7
Something to read
🗞 Chuck Smith shared a new edition of Women on Rails Newsletter #36: The year of the crab, build trust while remote, create good Pull Requests. Read the English version, French version, Italian version, Spanish version
🗞 Greg Molnar shared a new edition of This Week in Rails written by Petrik de Heus. Read Updated Permissions-Policy directives and LSP support?
🗞 Ruby Weekly published a new edition of their newsletter. Read Ruby Weekly 623
🗞 Ruby LibHunt published their 333 edition of Awesome Ruby Newsletter
🗞 Ruby Radar published their 71 edition Ruby Swag
One Ruby Thing shared a new article about Time extensions. Read it at andycroll.com
Brandon Weaver shared an article they wrote about promotions. Read it at dev.to/baweaver
Lewis Buckley shared an article they wrote about running multiple Rails apps with Puma-dev. Read it at world.hey.com/lewis
Konnor Rogers shared an article they wrote about modifying the default rendering of attachments from actiontext. Read it at dev.to/paramagicdev
Paweł Dąbrowski shared an article they wrote about security best practices for Rails. Read it at blog.appsignal.com
Brandon Weaver shared a new article they wrote about Data.define in Ruby 3.2.
Ayush shared a new article they wrote about to render error pages through the Rails stack rather than from the `/public` folder. Read it at dev.to/ayushn21
Brad Gessler shared a new article they wrote about running Rails Background Jobs with Fly Machines. Read it at fly.io
Rails Links shared an article about Pitfalls of using metaprogramming in Ruby on Rails application
Marco Roth shared an article they wrote about Custom Turbo Stream actions. Read Turbo 7.2: A guide to Custom Turbo Stream Actions
Adrian Marin shared a new article that they wrote about how Rails works with assets. Read New Rails asset compilation mental model
Something to watch 🎥 or listen 🎧
🎥 Ruby Learning Center shared the video they streamed for implementing Chapter 2 of Rebuilding Rails book. See Rebuilding Chapter 2
🎥 Drifting Ruby shared a new video about Hotwire introduction. See Hotwire introduction
🎥 Yaroslav Shmarov shared a new video they created where they show the power of rmagick with Ruby and Rails. See Rmagick to autogenerate images
🎥 Jared White shared a new video about HTML modules and going through the history of 25 years of web development. See The Rise (and Fall) and Rise Again of HTML Frameworks
🎥 Drifting Ruby shared the video version of This Week in Rails. See This Week in Rails - 2022-10-08
🎥 Adrian Marin shared a video presented by Norbert Wójtowicz at wroclove.rb 2022 about Grokking FP for The Practicing Rubyist
🎧 Audio & Podcasts
🎧 Joël Quenneville shared a new episode of The Bikeshed where he talks with Stephanie Minn about the value of specialized vocabulary and the power of names. Listen to The Value of Specialized Vocabulary
🎧 Jason Swett shared the final episode of Code with Jason where he talks with Nick Schwaderer. Listen to The Final Episode (for Now): Nick Schwaderer - The Code with Jason Podcast
🎧 The Ruby on Rails Podcast shareda new episode with Drew Bragg. Listen to The Rails SaaS Conference Hype Train with Drew Bragg
🎧 Ruby For All published a new episode of Ruby for All: How to Get Feedback with Emily Samp. Listen to How to Get Feedback with Emily Samp
🧰 Gems, Libraries, and Updates
🧰 Petrik de Heus shared an open issue in Rails repository talking about adding —interactive to rails new in Rails 7.1. Read the ongoing discussion here.
🧰 There is also an open discussion in Ruby bug tracker abour import module. Read it here. It might (or might not) come in the next Ruby version.
🧰 Rubygems News shared a new gem named easytest: that “is a tiny testing framework for Ruby with a familiar DSL”. Here is how the code looks like:
🧰 Jean Boussier shared a (pre)version of pitchfork - a new Ruby HTTP server optimized for latency and memory usage. Check it out at GitHub - Shopify/pitchfork. Here is a short comparison between this server and Puma:
🧰 Stan Lo shared that there is a new release of IRB v1.4.2. Check the changelog at GitHub ruby/irb
🧰 Joel Drapper shared a code sample from a new gem called playdate. Hre is how the code might look like:
🧰 Josef Strzibny shared a new gem they discovered dogweather/asset_ram that helps with memoization of asset links, thus saving a lot of allocations per request.
🧰 Mike Perham shared that Sidekiq Pro 6.0b1 and Sidekiq Enterprise 3.0b1 are now available for testing with Sidekiq 7.0b1. Check upgrade notes here
🧰 David Teren shared a gem written by Brandon Hicks called crossbeam. It allows to use validations, errors, before/after blocks and generators.
🧰 Tim Riley shared a new release of dry-configurable version 0.16.0. Read the changelog.
Music for coding and fonts
Irina Nazarova shared a new IDE font created by Roman Shamin called Martian Mono. Check it out here
Coding and Hacking Vibes (spotify) - electronic/instrumental
Music for Coding (spotify) - relaxing lo-fi hip hop and chillhop
Concentratio(Spotify) - a more alert music
Hip Hop LoFi Piano Beats for Progamming (Apple Music) - Lo-Fi with Piano
If you enjoyed this and want to receive the newsletter weekly in your inbox, consider subscribing: