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]
Ruby + Rails : Distilled
by @skillstopractice.com
Hand-picked list of posts that Ruby + Rails devs might find interesting. Maintained by: Gregory Brown ( @skillstopractice.com ) See how it works here: https://www.skillstopractice.com/distilled-faq Rather follow as an account instead of a feed? @distilled.skillstopractice.com
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.
Quick reminder that you should be using Jemalloc 👀 #rubyonrails #ruby
TIL about the ActiveSupport `mattr_accessor` method. It defines both class and instance accessors for class attributes. Handy little shortcut! 🔧 #ruby #rubyonrails
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.
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
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
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?
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
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...
Rails Tip: `rails routes --expanded`: If you can never find the controller#action being called by a route, expanded routes can help!
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
Feel like I'm missing something obvious but there's not a good way to filter params from `inspect` in Rails is there? My workaround is below, but hoping I'm missing something 😅
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
I will write a blog post about this when the PR lands, but Ruby 3.5 should have 6x faster object allocation
I prefer using getter methods over instance variables inside #Ruby objects. Allow me to explore this in the following posts 👇
Can you block ip addresses via Flipper? Yes, yes you can. Whipped this together this morning for a bad actor. I should probably do something more sophisticated but sometimes this is all you need.
I just realized Rails' 'titlecase' does not actually give you true, stylistically correct title case. Not a big deal, just caught me off guard 😅 Now I'm wondering if someone has gone through the effort of implementing that?
If you read @byroot.bsky.social 's "What's the deal with Ractors?", and were bummed at how poorly they handled JSON parsing, then @jhawthorn.com has brightened your day! Frozen interned strings are now stored in a lock-free hash, making the Ractor example 2x faster than the single-threaded example!
The Etc module — part of Ruby's standard library — provides access to all sorts of system data: user, groups, architecture, and a bunch more. No need to run commands like `uname` in your #Ruby code! docs.ruby-lang.org/en/3.4/Etc.h...
If you have more than one worker process sitting idle while the job queue is empty, you're throwing away money. And for queues with an SLO > 30 seconds, that number drops to zero.