Sign in

RubyCademy

@rubycademy.bsky.social
39 followers 0 following 7 posts

The best Ruby code examples. For more PRO Tips and foundational knowledge: 🔗 www.rubycademy.com

PostsRepliesMedia
RubyCademy @rubycademy.bsky.social · 15/05/2025
🔗 www.rubycademy.com 💚
010
RubyCademy @rubycademy.bsky.social · 01/05/2025
⚠️ Your booleans might be skipping validations… Did you know that `toggle!` calls `update_attribute` under the hood, which skips ActiveRecord validations? #rubyonrails #activerecord
020
RubyCademy @rubycademy.bsky.social · 01/05/2025
Want to assign default values to locals in your Rails partials? With Rails 7.1+, you can do it right in the `locals:` pragma! 🔗 www.rubycademy.com #rubyonrails
120
RubyCademy @rubycademy.bsky.social · 29/04/2025
If you’re just swapping characters in a string, use `String#tr`, not `String#gsub`. 💚 Why? No regex engine, faster execution, cleaner intent. #rubyonrails
0173
RubyCademy @rubycademy.bsky.social · 29/04/2025
If I encounter one more `if ... then ... else ... end` block, I’ll go blind. 👀 Use the ternary operator instead! 🙏 #rubyonrails #ruby
010
Reposted by RubyCademy
Lucian Ghinda @lucianghinda.com · 28/04/2025
Find out what's new inside 👉 All about Code and Ruby from @byroot.bsky.social , @bramjetten.dev @tenderlove.dev Vishnu M @hasumikin.bsky.social @jamie.schembri.me @Josef Strzibny @Matt Swanson @johnnunemaker.com @rubycademy.bsky.social and many more
Screenshot of news for All about code and Ruby from inside the newsletter
133
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
RubyCademy @rubycademy.bsky.social · 25/04/2025
"Rails is dead," they said! 😂 #rubyonrails
030