My articles, essays, and ramblings.
Kill N+1 Queries For Good with Strict Loading
Starting with Rails 6.1, we can set a strict_loading configuration option that, when true, will throw an error if your code attempts to lazy load any associations with out strictly including the association in the ActiveRecord query. A brief history on N+1 queries and Ruby on Rails Rails has a long history of scaling problems and a big cause of this is slow database performance of N+1 queries. Rails makes it super easy to get data from a database and magically have all of it at your finger tips.
Two Simple Books to Wealth
I should start off and say that I’m not a financial expert, but I do dedicate a good amount of time learning finance, managing cash, and investment planning - both in business and my personal life. In business school, one lesson that has always stuck with me is “Keep your eye on cash”. A simple but powerful statement that has served me well both in business and at home. I consider finance just another tool to generate additional revenue for me and my companies.
Hotwire, ViewComponent, and TailwindCSS: A New Era in Ruby On Rails Development
Forget Service Objects, Write Command Objects in Ruby
The term “service object” can mean different things depending on who you talk to or what project you inherited, hence why I put them in quotes. Since there’s not really a “Rails Way” to put business logic, it was common to shove everything into Active Record models. When that went awry, the concept of service objects came onto the scene and provided a pathway for storing domain logic in plain Ruby objects.
Creating a Rich Text Editor with Quill, Stimulus and Tailwind CSS
Adding rich text editors to a project has a long history of friction and frustration in development. Whenever I’m asked to add a text editor, I naturally do whatever I can do to avoid them completely. That, or make sure I do extra meditation in preparation for weeks of pain.
Hello, old friend
It’s nice to see you again. One of the toughest part of writing for me is taking the time to actually write. An unfortunate side effect of running a company (for me anyway) is the sheer amount focus it demands in order to maintain the level of successful and serve my clients the best way I can.