Tutorials
How to customize Rails I18n key suffixes like?`_md`?for Markdown | Island94.org
If you’ve had reason to use internationalization in Rails on Rails, you’ve probably used a nifty feature of it:
Keys with a _html suffix… are marked as HTML safe. When you use them in views the HTML will not be escaped.
Authoring HTML within tra...
The 'then' Ruby Keyword - What is it? – Ben Koshy – Rails, Tekla Open API, AutoDesk .NET
Have you heard of the then method? I’d never heard of it, till now:
The best way of learning is by implementing it in some code base you are reading - preferably your own (at least that’s how I learn and experiment). Otherwise what tends to happen...
Hotwire components that refresh themselves | Boring Rails: Skip the bullshit and ship fast
Earlier this year, I made a quick tweet about a pattern that I think makes working with Hotwire apps much better.
When you need to make a bit of UI that runs some code in the background, you can use turbo_streams to ‘refresh’ the front-end when t...
Rails 8 adds ability to use multiple rate limits per controller | Prateek Codes - Learn Building Scalable Backend Systems
Rails 7.2 introduced built-in rate limiting to Action Controller. However, you could only set one rate limit per controller, which wasn’t flexible enough for real-world applications. Rails 8 solves this by allowing multiple rate limits using the n...
Using Active Storage Direct Uploads in GraphQL with Ruby on Rails
We're using GraphQL a lot, and due to it's reusability nature, we often pair it with React.js and React Native applications.
However, one challenge we faced was file uploads. GraphQL doesn't come with a built-in way to handle file uploads. While ...
Comparing Idiomatic Spaceships in Ruby - hartley mcguire
If you want to make a Ruby class comparable (ex. a > b), all you have to do is implement the "spaceship" method, <=>, and include the Comparable module. But how do you implement the spaceship?
If your class is simple, maybe a Die with 6 faces, yo...
Capture Browser Console Logs in Rails System Tests with Capybara and Cuprite · Daniela Baron
When writing Rails system tests, a common practice is to use Capybara to simulate user interactions. If the front end is a JavaScript-heavy Single Page Application (SPA), this also requires installing and configuring a JavaScript driver for Capyba...