Sign in

Ruby + Rails : Distilled

@distilled.skillstopractice.com
67 followers 156 following 18 posts

A collection of posts of interest to Ruby and Rails developers. Hand-picked, high signal, always on topic. Maintained by @skillstopractice.com Also available as a feed: bsky.app/profile/did:plc:ip3trmvdbn…

PostsRepliesMedia
Reposted by Ruby + Rails : Distilled
Gregory Brown @skillstopractice.mastodon.social.ap.brid.gy · 28/09/2025
I just signed the open letter to the Rails Core team, after hesitating for a long time about whether that was the right choice for me. I know and like several Rails core members, as well as several Basecamp employees. I understand the squeeze that can happen when speaking out individually only […]
mastodon.social
Original post on mastodon.social
164
Reposted by Ruby + Rails : Distilled
Gregory Brown @skillstopractice.mastodon.social.ap.brid.gy · 22/09/2025
So the way I read this is a sponsor forced this action by Ruby Central. If that sponsor was Shopify, then in effect, this confirms that a company that DHH is a board member of forced this action. If not, who was responsible for this then? This is a very […] [Original post on mastodon.social]
172
Ruby + Rails : Distilled @distilled.skillstopractice.com · 21/05/2025
Ruby + Rails : Distilled is moving to Mastodon. Just getting set up over there but you'll find the account here: ruby.social/@distilled I will set up bridging when I can, not sure if I will do crossposting though. If you're set up with @ap.brid.gy here I can still share your posts that way.
171
Reposted by Ruby + Rails : Distilled
Gregory Brown [MOVED, SEE BIO] @skillstopractice.com · 19/05/2025
I'm leaving Bluesky effective immediately and this is the reason why. I'll post when I get Mastodon set up + an RSS feed + newsletter.
021
Reposted by Ruby + Rails : Distilled
Jamie Schembri @jamie.schembri.me · 17/05/2025
The penultimate part of SOLID: the Interface Segregation Principle.
schembri.me
SOLID: Interface Segregation Principle (ISP)
The Interface Segregation Principle is about designing thin, cruft-free interfaces which results in reduced coupling.
063
Reposted by Ruby + Rails : Distilled
Josh Frankel 💎🔛🛤️ @joshfrankel.bsky.social · 15/05/2025
ViewComponents reduce bloat, simplify data, and create reusable frontend styling. Despite these benefits, they're often under-utilized in the Rails community. I've written a blog post refactoring a real-world example into isolated ViewComponents. joshfrankel.me/blog/viewcom... #ruby #rubyonrails
joshfrankel.me
ViewComponents, the Missing View Layer for Rails
If you’ve worked with Rails for any measure of time, then you know that Rails’ Views can quickly get out of hand. Between Helpers, instance variables, and inline logic, they quickly become bloated and...
142
Reposted by Ruby + Rails : Distilled
David @dcyoung.dev · 16/05/2025
You might get less performance from using `.excluding` than `.where.not` and here's why. dcyoung.dev/shorts/how-e... #RubyOnRails #WebDevelopment
dcyoung.dev
🎓 How .excluding works in Rails
Rails provides a convenient .excluding method for identifying a group of items while omitting another set.
081
Reposted by Ruby + Rails : Distilled
Jamie Schembri @jamie.schembri.me · 16/05/2025
How do you manage error classes in your app? - Granular — Domain::Specific::NotFoundError - Generic/Reusable — Error::NotFound - Not — StandardError/raise 'x' Personally, I create my own error classes so I can see what's wrong at a glance, even if it means catching existing ones. #RubyLang
573
Ruby + Rails : Distilled @distilled.skillstopractice.com · 16/05/2025
Already several good RSS feeds in the thread. Keep them coming! Discoverability is hard these days and RSS was one of those lovely tools that deserves a comeback.
011
Ruby + Rails : Distilled @distilled.skillstopractice.com · 16/05/2025
If you've got a blog where you (at least sometimes) write Ruby-related posts, please reply with a link to your RSS feed below. I am going to try to start keeping an eye on those as well and sharing interesting stuff I find from time to time.
14108
Reposted by Ruby + Rails : Distilled
Javier Cervantes @jvrc.ca · 15/05/2025
What do you love about programming in #ruby?
932
Reposted by Ruby + Rails : Distilled
Jamie Schembri @jamie.schembri.me · 15/05/2025
Don't want to expose a class' initializer in Ruby? Making it private is easy! Just use `private_class_method :new`. This conveys intent that your class is not designed to be initialized from outside — perfect when you want to use the factory pattern.
Screenshot of Ruby code:

class Pizza
  def self.margherita
    new(sauce: 'tomato', cheese: 'mozzarella', toppings: %w[basil])
  end

  def self.vegetariana
    new(sauce: 'tomato', cheese: 'mozzarella',
        toppings: %w[aubergine mushrooms peppers onions olives])
  end

  private_class_method :new

  def initialize(sauce:, cheese:, toppings:)
    @sauce = sauce
    @cheese = cheese
    @toppings = toppings
  end
end
Screenshot of Ruby code:

Pizza.margherita
# => #<Pizza:0x0000000121c17f10
#      @cheese="mozzarella",
#      @sauce="tomato",
#      @toppings=["basil"]>

Pizza.vegetariana
# => <Pizza:0x0000000120f34988
#      @cheese="mozzarella",
#      @sauce="tomato",
#      @toppings=["aubergine", "mushrooms", "peppers", "onions", "olives"]>

Pizza.new(sauce: 'white', cheese: 'none', toppings: %w[pineapple])
# => private method 'new' called for class Pizza (NoMethodError)
0325
Reposted by Ruby + Rails : Distilled
Hans Schnedlitz @hansschnedlitz.com · 15/05/2025
How to automatically trigger a file download with Turbo? The user triggers the creation of a file. That file is created using a background job. I could update the view using Turbo Streams (e.g. render a 'Download Now' button). But I'd like download to automatically start 🤔 #rubyonrails
231
Reposted by Ruby + Rails : Distilled
Xavier Noria @fxn.bsky.social · 15/05/2025
Namespaces 101 During the last days I have done an immersion into namespaces, the new big feature that is coming in Ruby. Here's a digested mental model for you all. gist.github.com/fxn/86ad8584...
gist.github.com
namespaces.md
GitHub Gist: instantly share code, notes, and snippets.
5308
Reposted by Ruby + Rails : Distilled
nateberkopec.bsky.social @nateberkopec.bsky.social · 14/05/2025
Incredibly common Rails perf anti-pattern: Rails.cache.fetch([complicated,cache,key], expires_in: random_interval) do dog_of_a_SQL_query end Cache hitrate: 10% (if anyone even knows what it is)
2191
Reposted by Ruby + Rails : Distilled
Hans Schnedlitz @hansschnedlitz.com · 14/05/2025
Quick reminder that you should be using Jemalloc 👀 #rubyonrails #ruby
262
Reposted by Ruby + Rails : Distilled
Jamie Schembri @jamie.schembri.me · 14/05/2025
Right, it was merged: github.com/ruby/ruby/pu...
github.com
Retire CGI library without `cgi/escape` by hsbt · Pull Request #13275 · ruby/ruby
https://bugs.ruby-lang.org/issues/21258
041
Reposted by Ruby + Rails : Distilled
Alfonso Uceda @alfonsouceda.eurosky.social · 14/05/2025
I guess you will need to include cgi gem: github.com/ruby/cgi
github.com
GitHub - ruby/cgi: CGI is a large class, providing several categories of methods, many of which are mixed in from other modules.
CGI is a large class, providing several categories of methods, many of which are mixed in from other modules. - GitHub - ruby/cgi: CGI is a large class, providing several categories of methods, ma...
041
Reposted by Ruby + Rails : Distilled
Peter Solnica 🇺🇦 🇵🇱 🇪🇺 @solnic.dev · 14/05/2025
hey #RubyLang folks - our tests against Ruby head in sentry-ruby started failing yesterday with: LoadError: cannot load such file -- cgi/cookie I'm disabling ruby head version in our CI matrix for the time being but maybe there's a fix somewhere?
251
Reposted by Ruby + Rails : Distilled
Kent Beck @kentbeck.com · 14/05/2025
Your periodic reminder that consolidating a wobbly design is worse than a waste of time, it interferes with further improvement. Sometimes the best thing is put all the elements in one pile until the fault lines become clear. #AugmentedCoding #GeniesDesignBadly
1297
Reposted by Ruby + Rails : Distilled
KOW @kow.fm · 13/05/2025
What's the best host for running a Ruby application, that stores files on the server, and runs sqlite as the database, on the server?
231
Reposted by Ruby + Rails : Distilled
Gregory Brown [MOVED, SEE BIO] @skillstopractice.com · 13/05/2025
Having setters that appear to be at the instance level apply at the class level is something that (for me) definitely would be against the Principle of Least Surprise. An easy way to define class level accessors is nice but hard to see the use case for the instance level behavior.
051
Reposted by Ruby + Rails : Distilled
Hans Schnedlitz @hansschnedlitz.com · 13/05/2025
TIL about the ActiveSupport `mattr_accessor` method. It defines both class and instance accessors for class attributes. Handy little shortcut! 🔧 #ruby #rubyonrails
482
Reposted by Ruby + Rails : Distilled
Konnor Rogers @konnorrogers.com · 12/05/2025
sounds like @fractaledmind.bsky.social 's Acidic Job github.com/fractaledmin...
github.com
GitHub - fractaledmind/acidic_job: 🧪 Durable execution workflows for Active Job
🧪 Durable execution workflows for Active Job. Contribute to fractaledmind/acidic_job development by creating an account on GitHub.
151
Reposted by Ruby + Rails : Distilled
Sam Rose @samwho.dev · 12/05/2025
Absolutely love this. Have figured out a bunch of this stuff from first principles over the last 2 years, but still loads of goodies in here. plainvanillaweb.com/index.html
plainvanillaweb.com
Plain Vanilla
An explainer for doing web development using only vanilla techniques.
6517
Reposted by Ruby + Rails : Distilled
Jamie Schembri @jamie.schembri.me · 12/05/2025
Consider using pattern matching in Ruby. I wanted to update a user's location (RGeo Point) from an endpoint which receives a JSON object: { lat: ..., lng: ... }. Using pattern matching, we can detect such an object's shape, falling back to a catch-all (_) with an if statement for regular Points.
A screenshot of ruby code. The contents are:

class User < ApplicationRecord
  def location=(value)
    case value
    in { lng:, lat: }
      super(self.class.point_factory.point(lng, lat))
    in _ if value.respond_to?(:latitude) && value.respond_to?(:longitude)
      super
    else
      raise ArgumentError, 'Invalid location format'
    end
  end
end

user = User.last
user.update!(location: { lng: 4.8922, lat: 52.3731 })
user.location
# => #<RGeo::Geographic::SphericalPointImpl:0x4610 "POINT (4.8922 52.3731)">
0195
Reposted by Ruby + Rails : Distilled
Onur Ozer @onurozer.me · 11/05/2025
What's the "Rails" way of designing a multi-step workflow with background jobs? Each job triggering the next, active record callbacks, state machines or something else? Help!
783
Reposted by Ruby + Rails : Distilled
Mohamed Hassan @oldmoe.bsky.social · 05/05/2025
TinyBits: A new schema-less binary serialization format. Fast to encode, fast to decode and generally smaller output than all other schema-less formats. Currently available as a preview for C and Ruby. A Python module is also in the works. oldmoe.blog/2025/05/05/s...
3155
Reposted by Ruby + Rails : Distilled
Mohamed Hassan @oldmoe.bsky.social · 09/05/2025
TinyBits is getting a new interesting feature, you can now (using the repo's head) supply the pack/unpack method with an external dictionary. For shorter messages with no duplicate strings this can lead to a dramatic size reduction, from 96 to 34 bytes in the example below
132
Reposted by Ruby + Rails : Distilled
Jamie Schembri @jamie.schembri.me · 10/05/2025
Today in SOLID: The Liskov Substitution Priciple.
schembri.me
SOLID: Liskov Substitution Principle (LSP)
The Liskov Substitution Principle applies to any OOP language. On the surface it is a structural pricinple, but its true lesson is concerned with behaviour.
363
Reposted by Ruby + Rails : Distilled
Javier Cervantes @jvrc.ca · 09/05/2025
An interesting tool to avoid those pesky issues with ivars in #ruby
151
Reposted by Ruby + Rails : Distilled
Lucian Ghinda @lucianghinda.com · 07/05/2025
I write mostly about #RubyLang here allaboutcoding.ghinda.com And I write shorter notes (mostly saving some of the posts I share on social media) at notes.ghinda.com
allaboutcoding.ghinda.com
All about code - Ruby and Rails technical content written by Lucian Ghinda
I write here quick thoughts, ideas, tips, and learnings about programming, programmers, and building software. Most of my focus is on Ruby, Rails, Hotwire, and everything about web applications.
051
Reposted by Ruby + Rails : Distilled
Jeremy Smith @jeremysmith.co · 08/05/2025
If you wanted to measure the volume of newcomers to Rails (even just a rough approximate), how would you do it?
361
Reposted by Ruby + Rails : Distilled
Hans Schnedlitz @hansschnedlitz.com · 08/05/2025
I want to prefix a string only if it's not already prefixed. Somehow this feels...wrong. Does anyone know a more refined solution? 🤔 #ruby
441
Reposted by Ruby + Rails : Distilled
dan @danabra.mov · 06/05/2025
who up there writing their blog? i want to see yalls blogs! criteria: - you wrote at least a post in 2025 - it doesn't force a paywall so we can actually read it
23226441
Reposted by Ruby + Rails : Distilled
🎱 Josh Branchaud ✨ @jbranchaud.bsky.social · 06/05/2025
With charge-per-request 3rd-party services (not only LLM APIs), how are you managing spending limits within your apps? I know some of these services have budget features, but I'm more interested in strategies where you have your own spend control -- e.g. rate limiting, token buckets, alerts...
122
Reposted by Ruby + Rails : Distilled
Peter Solnica 🇺🇦 🇵🇱 🇪🇺 @solnic.dev · 06/05/2025
Who's actually using #Ruby LSP in #VSCode to run tests? I am trying it out today and its command to run all tests from current file seems to be running *each test scenario* in a separate process. This means that running all tests is dead slow. Am I doing something wrong?
A screenshot from test results in VS Code using Ruby LSP extension showing that running all tests from sentry_spec.rb file takes 49s instead of less than a second.
242
Reposted by Ruby + Rails : Distilled
Aaron Sumner @ruralocity.bsky.social · 06/05/2025
Anyone have better approaches to wiping Active Storage files after #RSpec test runs in #RubyOnRails? ``` config.after(:suite) do dir = ActiveStorage::Blob.services.fetch(:test).root FileUtils.rm_rf(dir) FileUtils.mkdir_p(dir) FileUtils.touch(File.join(dir, ".keep")) end ```
151
Reposted by Ruby + Rails : Distilled
Jeremy Smith @jeremysmith.co · 05/05/2025
Using database constraints (not nulls, foreign keys, unique compound indexes, etc.) in your Rails app isn't just good for data integrity. It also indicates system intent to others in a way that using Active Record validations alone just can't.
3365
Reposted by Ruby + Rails : Distilled
Brad Gessler @bradgessler.com · 05/05/2025
Terminalwire is now open source! I finally had time to think through the license and landed on AGPL. More in the article about "why", "why now", and a tour of the source code on Github. terminalwire.com/articles/agp...
terminalwire.com
Terminalwire is open source
Now available under the GNU Affero General Public License
3347
Reposted by Ruby + Rails : Distilled
Hans Schnedlitz @hansschnedlitz.com · 05/05/2025
I love what you can do with Hotwire & a bit of Stimulus 🤩 Here's a quick way to lazy-load some content on click using an empty turbo frame. Setting the source attribute automatically loads the content. #rubyonrails
051
Reposted by Ruby + Rails : Distilled
Stan Lo @st0012.dev · 01/05/2025
You can try `kill -s BUS <pid>` to make Ruby dump a crash report, which will include backtrace. (@byroot.bsky.social taught me this)
161
Reposted by Ruby + Rails : Distilled
Thiago Araujo @thdaraujo.bsky.social · 01/05/2025
When a controller is full of custom actions named: - `#create_[thing]` - `#update_[thing]` - `#delete_[thing]` It usually means that `[thing]` is a missing concept in your domain. Consider extracting those actions into a new `[things]_controller.rb` class or something similar.
0111
Reposted by Ruby + Rails : Distilled
Jamie Schembri @jamie.schembri.me · 01/05/2025
Finally got the second post of my SOLID series out — The Open–Closed Principle. Had a great time writing about this one, digging up Bertrand Meyer's classic book and reflecting on how we used to build software back when I was a (slightly) smaller Jamie. schembri.me/solid-the-op...
schembri.me
SOLID: The Open–Closed Principle (OCP)
We visit the second SOLID principle: the open–closed principle (OCP). Does it still hold up, or is it bad advice in today's agile world?
195
Reposted by Ruby + Rails : Distilled
Thiago Araujo @thdaraujo.bsky.social · 01/05/2025
Rails Tip: `rails routes --expanded`: If you can never find the controller#action being called by a route, expanded routes can help!
execution of the command `bin/rails routes --expanded` and its output: a table of routes containing detailed information in order.
1206
Reposted by Ruby + Rails : Distilled
Chris Oliver @excid3.com · 30/04/2025
Also migrated @hatchbox.io from Stripe Usage Records which are now deprecated to Billing Meters. Pay now uses Stripe v15 which no longer includes Usage Records. The migration is a bit trickier than it seems, so I wrote up some notes in the Pay docs: github.com/pay-rails/pa...
github.com
161
Reposted by Ruby + Rails : Distilled
Onur Ozer @onurozer.me · 30/04/2025
Rails devs running SQLite in production – has there been anything that you've missed or regretted so far?
262
Reposted by Ruby + Rails : Distilled
Hans Schnedlitz @hansschnedlitz.com · 30/04/2025
I got tripped up when using `turbo_replace` vs `turbo_update`. Remember kids, `turbo_update` only replace the stuff inside your turbo tag - `turbo_replace` replaces the turbo tag itself too 🤷 #rubyonrails
131
Reposted by Ruby + Rails : Distilled
RubyCademy @rubycademy.bsky.social · 28/04/2025
Rails 8 introduced `rate_limit` for controllers. You can combine it with a `handle_rate_limit` method + a `BusyController` to centralize how you respond to throttled requests. Keeps things clean and makes it super easy to extend later. #rubyonrails
021
Reposted by Ruby + Rails : Distilled
Gregory Brown [MOVED, SEE BIO] @skillstopractice.com · 29/04/2025
When does an incorrect software behavior become a bug? (1) The moment the code is written, even if caught immediately (2) As soon *anyone else* might encounter the issue (devs, QA testers, product managers, client, etc) (3) Only when something breaks in production during real use. Your thoughts?
542