All posts tagged with 'ruby on rails'
Naming Things Is Hard
Choosing good names for objects and methods in code is one of the toughest things to do as a software engineer. It comes with the great and invisible reward of simplicity – second only to having less code in the first place, having code that’s easy to reason with makes extending it and debugging it in incident scenarios all the easier. Of course, the opposite is true as well – code that… Continue reading
Persisting nested form attribute indexes through Turbo updates
Introduction We recently encountered an interesting problem when using Turbo Streams to update part of a complex nested form in FreeAgent’s main Ruby on Rails web application. For those unfamiliar, nested forms allow a user to enter data relating to both a main parent object and its associated objects. This could be, for example, a contact form which also supports creating and editing multiple associated addresses. To illustrate the problem… Continue reading
A refreshing take: using serverside rendering to reduce fragile DOM state
Hotwire is central to how we drive the frontend at FreeAgent, and Action Cable allows us to send Turbo Streams as users browse the site, adding a layer of richness to the user experience. Continue reading
Waiting for it with Capybara’s synchronize method
Feature specs are notorious for their potential to flake. It’s possible for the results of feature specs to be inconsistent because they have to deal with asynchronous state. In a typical test environment, there’s a single Ruby process at play, so test code will be executed in order as written – we can reasonably expect one line to complete before the next is executed. But when it comes to feature specs… Continue reading
Wiggling my way to a win
The work calendar At FreeAgent, we work in intervals of sprints (2 weeks) and cycles (which are made up of 4 sprints – adding up to roughly 2 months total). In a cycle a team typically aims to complete 1 larger project, and during a sprint a team aims to complete sub-tasks of that larger project. This helps construct timelines and structure for product managers and engineers to work within. … Continue reading
The Other Copilot: Coding with AI
It seems Copilots are ten a penny these days. While our CoPilot accountant partners are a human way to support you using FreeAgent, the flight term has really taken off(!) as branding for AI tools, GitHub’s Copilot being just one of them. The rise of AI tooling for developers has sparked a lot of discussion and controversy as of late. It’s also seen rapid development and innovation, with several code… Continue reading
Mission jQuery Zero: How FreeAgent removed jQuery from our application
Just over 3 years ago FreeAgent was running with 4 front-end frameworks, Stimulus, React with Redux, Rails UJS and jQuery and we were about to start adding Turbo to the stack. Running all these different frameworks was not sustainable and we chose to reduce our number of dependencies and first up was jQuery. We called this our legendary jQuery code, code that had helped us grow a business and provide… Continue reading
A case of missing validation messages
I’ve recently worked on two very similar issues within the FreeAgent app, which is a Rails web application. The problem that was reported in both cases was that when a user tried to submit invalid data they didn’t get any kind of message indicating what went wrong. In case it helps someone else (and let’s be honest to remind myself when I undoubtedly come across it again) I thought I’d… Continue reading
The architecture of FreeStyle, our design system
We embarked on a journey to create a design system at FreeAgent over 2 years ago. In this blog post I will describe how we structure our design system code and how it’s being used across different codebases. Technologies we use Our main design system consumer is the FreeAgent web application, a Ruby on Rails application. As a result, we write our components using the Ruby on Rails ViewComponent framework… Continue reading
Readable Dates in Rails
I was playing around in Swift recently, and wanted a reference to 'one day ago'. This is simple enough in human terms: if it's 9:30 on the 18th of September, 'one day ago' means 9:30 on the 17th of September. The Swift code to do this looks like this: Calendar.current.date( byAdding: .day, value: -1, to: Date.now ) ...and that's just a bit much, isn't it? First we need to access Calendar.current, a singleton… Continue reading