Intro If I am looking to maximize the performance of a Ruby app what should I be using? Hashes, Structs, OpenStruct, or Classes? New Ruby programmers love hashes. I love hashes. They are very flexible and tempting to add in everywhere. Even when refactoring a slow part of the system in Kafka microservices so that … Continue reading Classes, Hashes, Structs and OpenStructs in Ruby
1. Eat your frogs. “Eat a live frog every morning, and nothing worse will happen to you the rest of the day.” -Mark Twain Seriously. The first step is that you already know what you have to do. Just do the thing you are dreading. Defeat Bowser and then go back and smash those Koopa … Continue reading How to be a productive developer.
Ever open up a Rails console to debug a problem and come away wondering how the data got so funky? Despite our best efforts, the database will accept plenty of garbage data if you let it. There are tons of methods to bypass the Rails callbacks and validations while still updating your database. If you … Continue reading Pushing Rails validations down to the database?
A native extension is simply C code that needs to be compiled and that might link a Ruby gem library or component to a non-Ruby library. For instance, a Ruby gem that uses nokogiri has a C code (native extension) that interacts with nokogiri and represents a link from the Ruby gem to nokogiri. A … Continue reading What are native extensions in Ruby?
Remember coding a static HTML site by hand? That’s how I got started. It was fun and easy to build a website because they were so simple. Now they are getting pretty complex. Single page apps that talk to an API-only backend can get you some pretty impressive results but also suck more and more … Continue reading Hotwire. Making the front end fun again?
Or any other programming language. Do you ever wish that you could memorize an entire programming language and all of the libraries and APIs that you use constantly? Want to become as fluent in the technical concepts and jargon as you are in your native language? Well, I can’t give you that but I can … Continue reading Using Anki to Learn Ruby
Do you have a Rails app that has gotten so big it is getting hard to know what is going on? When you have a new Rails app it is easy to tell what the app does by looking at the files in the models’ folder, but as the app gets bigger you often lose … Continue reading An alternative to organizing large Rails projects with Namespacing
Update: User MelissaLiberty from Reddit pointed out how they would improve the form object and some of it faults. The form object has been updated to reflect their excellent points. Often, when we start a new Rails app we start with simple controllers, and we start by generating everything with scaffolding. There is nothing wrong … Continue reading Creating multiple models with form objects in Rails.
So you’ve inherited an app. It is pretty well tested and doesn’t throw too many errors but the app is big enough that it is hard to tell what is going on most of the time. The original developers are long gone and you need to build new, mission-critical features into the app but writing … Continue reading Killing dead Rails controllers
TLDR: Yes for apps. No Yes for Gems. Do you use version control to keep track of changes to your codebase? Or do you think version control is for the cowardly and just change files in a shared team folder and hope no one else is changing it at the same time? Of course not. … Continue reading Should you add Gemfile.lock to Git?
So you want to know fast your Rails app is going? If you just want to see how fast a bit of code is you can use the Benchmark module which is part of the Ruby Standard Library. If you want to compare two or more bits of Ruby code that do the same thing … Continue reading Rails Benchmarking
Aging Rails apps can become a bit of a mess. Fortunately, we can fix this bit by bit. Today we will look at some rules for writing a clean, readable Gemfile. 1. The gems should be split into groups. (Test, Development, etc.) Any Gemfiles that look like this can get messy as they get longer: … Continue reading Cleaning up a messy Gemfile
So, Ruby is well known for its hugely popular gem Rails which greatly simplifies building websites. But what are some other programs built-in Ruby? Here are a few very popular examples. RubyMotion – Develop native apps for iOS (both iPhone and iPad) and OS X in Ruby. It is based on MacRuby which was developed … Continue reading Ruby off Rails
I created a gem called tiedye and I wanted to explain a bit of my reasoning behind why I named it that. So, let’s talk about naming. Why call this gem tiedye? How do I decide to name Ruby gems in the first place? First, there are a few community conventions on how to name … Continue reading Naming Ruby Gems