In earlier versions of Elasticsearch, types were a convenient way to categorically organize documents within a single index. However, types were eventually deprecated, pushing developers toward a type-less structure in Elasticsearch 7 and later versions. Recently while working on a project to migrate a Rails application from Elasticsearch 2 to OpenSearch 2, we faced the challenge of identifying a way to replicate this behavior in a way that is allowed with OpenSearch. In this blog we will discuss how types were used for document organization and how to achieve the same behavior in OpenSearch.
Read moreFor developers, segmentation faults can feel like a sudden nightmare—cryptic errors that crash your application out of nowhere. This frustration is amplified when they show up in high-level languages like Ruby, where memory management is typically handled behind the scenes. Recently, while running my Ruby application, I experienced a segmentation fault caused by a gem. The crash not only halted my program but also left me facing a daunting debugging challenge. In this post, I’ll talk about how I identified the issue, debugged it, and eventually found a solution.
Read moreMany times, when looking at applications we have written or that we see around in repositories throughout the internet, we get this feeling that whatever we’re reading has a certain complexity too it. Sometimes this complexity is manegeable and expected. Sometime it’s not. Actually, very frequently, code can be difficult to understand and we usually describe such code as being overcomplicated, for example.
But it’s not just our understanding of written code that suffers. As expected, if code is more complex, it will also require more effort on the part of the computer to execute. And while efficient code might not necessarily be easy to understand, there is indeed such a possibility as code that is hard for humans to read and hard for hardware to compute.
However, in order to try to make things simpler and, especially, in order to coordinate within teams what is acceptable and what isn’t in terms of complexity, we need something that can help us measure complexity.
There are, of course, many metrics that can be used. In this article we’ll talk about cyclomatic complexity.
Read moreThere’s abundant online guidance about refactoring controllers and keeping them lightweight, but resources on model refactoring are less common. In this blog, we’ll explore some techniques for effectively refactoring models.
Read moreIn this post, we share our approach to refactoring Rails applications, focusing on improving code maintainability, reducing technical debt, and ensuring scalability. Discover the tools, techniques, and strategies we use to transform complex codebases into cleaner, more efficient systems.
Read moreThis article is part of our Upgrade Rails series. To see more of them, click here.
This article will cover the most important aspects that you need to know to get your Ruby on Rails application from version 7.2 to version 8.0.
Read moreDiving into an existing Rails application for the first time can feel a bit overwhelming, especially when you’re trying to piece together how everything works. In this article, we’ll walk you through the process of truly understanding (or grokking) an existing Rails app for the first time.
Read moreWhen upgrading from Rails 3.0 to 3.1, one of the common issues we face is the breaking change in ERB syntax for helper methods. This change impacts form_tag
, form_for
, content_tag
, javascript_tag
, fields_for
, and field_set_tag
.
The main issue is that these helper methods in Rails 3.1 now require the use of <%= %>
to output content, whereas in Rails 3.0 (and earlier), they used <% %>
without needing to explicitly output the form content. This change is not backward-compatible, and applying it across a large codebase can be quite tedious when we are using our method of dual booting an application to do an upgrade.
In this article we will explore a few possibilities we have uncovered in the past few years while doing these upgrades.
Read moreToday I’m happy to share that RailsBump is now being supported and maintained by our team. I wanted to take a moment to explain why this project is so important to our mission of reducing technical debt in our internal, open source, and clients’ applications.
Read moreThe other day, I was setting up a client project when I came across this dreaded error when running bundle install
:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
Have you ever gotten this error and spent hours of your day trying to install the missing gems? In this article, learn why this error occurs and how to solve it for good.
Read moreThese days, maintaining a secure codebase is crucial. Vulnerabilities in your application’s dependencies can pose significant risks to the security of your application. This is where tools like bundler-audit come into play. bundler-audit
is a gem that helps you identify and manage security vulnerabilities in your Rails application’s external dependencies. In this article, we will explore how to use bundler-audit
to keep your Rails codebase secure.
Ruby on Rails has a new maintenance policy and it can be a bit confusing as to what it means for both new and existing Rails projects. In this blog, we are going to summarize all the details, changes and important dates to help your team plan your next upgrade.
Let’s take a look!
Read moreWhile working with a client, we noticed that they had two Gemfiles: one with gems specifically for development and local references to a gem, and the other with a reference to a resource on GitHub. They wanted to switch between the local installation of the gem and the external GitHub reference based on whether they were in development or production. This approach worked well for their needs; however, our team was concerned that one downside was the difficulty in maintaining two separate Gemfiles. In this article, we will discuss an approach to creating conditional Gemfiles for development.
Read moreThis article is part of our Upgrade Rails series. To see more of them, click here.
This article will cover the most important aspects that you need to know to get your Ruby on Rails application from version 7.1 to version 7.2.
Read moreIn a previous blog post, How Do You Know When Your App is Not Compliant?, I briefly discussed the importance of the accessibility standards of Web Content Accessibility Guidelines or WCAG, to ensure that everyone, including those with disabilities, can use web applications effectively. In this blog, we are going to further explore the importance of maintaining accessibility compliance, what it means to users, as well as how to use the axe-core-gems for automated accessibility testing to help identify and resolve any gaps that may be currently present in a project.
Read more