Process slow network requests with Turbo and Active Model
Learn how to build a dynamic loading screen without writing a line of JavaScript.
Read MoreLearn how to build a dynamic loading screen without writing a line of JavaScript.
Read MoreHarness the power of Active Model to supercharge your search forms.
Read MoreWe explore several solutions to a common Hotwire problem.
Read MoreFor a long time, I thought that using React with Rails was an "all-or-nothing" proposition. I'm now realizing that the two can be integrated on a spectrum.
Read MoreThe next release of Rails will ship with a CI template that will "work out of the box"... unless you're using RSpec.
Read MoreLearn how to authorize requests at the routing layer to improve security and ergonomics.
Read MoreMy client project uses a polymorphic relationship between several models in an effort to create a flexible system of associations.
Read MoreHow do you manage queries when your Rails application isn't the only thing reading your database?
Read MoreRead this the next time you need to build a complicated form.
Read MoreRails writes a new cache entry based on the first request. But what happens when that request is from an admin?
Read MoreLearn how to improve the interface of your existing Active Record Models with this underutilized API.
Read MoreLearn about an unexpected limitation with this API and how to combat it universally.
Read MoreWhen writing an integration or system test in Rails, have you ever needed to click a link in an email? This is especially important for testing links with a unique token or that expire, such as password reset emails. Simply checking that the link exists is not sufficient, since the page it leads to is ephemeral.
Read MoreTime dependent tests are difficult to diagnose, and the symptoms don’t present themselves until it’s too late. This article will help you determine if your test suite is time dependent.
Read MoreYou probably use some type of error monitoring software to notify you when an exception is raised in your application, but are you being notified when there is an anomaly in user behavior?
Read MoreHow do you even save a “duration”, let alone query for records by that value? It’s actually easier than you think.
Read MoreLearn how to track user events without sacrificing privacy and performance.
Read MoreRails ships with a setup script that automates bootstrapping a new application, but did you know that you’re free to edit this script? In this quick tutorial, I’ll show you how you can improve the default Rails setup script to create a more consistent and helpful onboarding experience for folks on your team.
Read MoreLearn how to effectively render tooltips in Rails without writing any JavaScript.
Read MoreIf you’re like me then you probably take Devise for granted because you’re too intimidated to roll your own authentication system. As powerful as Devise is, it’s not perfect. There are plenty of cases where I’ve reached for it only to end up constrained by its features and design, and wished I could customize it exactly to my liking.
Read MoreDo you need to create real-time features in your Rails app, but either can’t use Turbo or don’t want to use a front end framework like React? Fortunately older versions of Rails actually provide this functionality of the box. In this tutorial I’ll show you how to create a single page app in Rails from scratch using remote elements and Stimulus.
Read MoreAre certain pages on your Rails app loading slowly? You might want to consider loading those requests in the background. It’s easier than you think. In this tutorial I’ll show you how to lazy load content in Rails without Hotwire.
Read MoreIn this tutorial, I’ll show you how to add a link to any Rails Mailer that will allow a user to automatically unsubscribe from that email. As an added bonus, we’ll build a page allowing a user to update their email preferences across all mailers.
Read MoreIn this tutorial, we’ll build a full-featured API in Rails with authentication. Below is what we’ll cover.
Read MoreIn this tutorial you’ll learn how to search across multiple models in Rails. Below is a demo of what we’ll be building. Note how both Post and User records appear in the search. As an added bonus, we highlight the search query in the results.
Read MoreIn this tutorial, I’ll show you how to create a feature flag system in Rails using pundit and a features column on the users table.
Read MoreLearn how to validate a form in real-time while conditionally preventing it from being submitted.
Read MoreIn this tutorial, I’ll show you how to add an infinitely scrolling blog roll using Rails and Hotwire. Note that this is different than Chris Oliver’s awesome infinite scroll tutorial, in that we’re loading a new post once a user scrolls to the bottom of a current post. Below is a demo.
Read MoreIn this tutorial I’ll show you how to leverage the Microlink API to generate link previews in Ruby on Rails.
Read MoreIn this tutorial I’m going to show you how to automatically save form data in Rails. Instead of saving a draft to the database, we’ll simply leverage Stimulus JS to save the data to localStorage. Below is what we’ll be creating.
Read MoreImagine you have multiple identical elements on a page and that you need to select a specific element during a system test.
Read MoreI know many existing tutorials explain how to install Bootstrap 4 on a Rails 6 application with Webpacker (like the GoRails example). However, I wanted to create this tutorial to highlight a few gotchas, as well as highlight why and how I made some of my choices.
Read MoreIn this tutorial I am going to show you how to configure Travis CI to run your Rails’ test suite and system tests everytime you push a new change to your repository.
Read MoreIn this tutorial I am going to show you how to revert and restore records using the PaperTrail Gem.
Read MoreBy default, Rails displays the record’s ID in the URL (e.g. http://localhost:3000/articles/1). Although there is nothing inherently wrong with this approach, sometimes it’s helpful to obfuscate the record’s ID (e.g. http://localhost:3000/articles/xb3mm6k). In this tutorial I will show you how to obfuscate numerical IDs in Rails.
Read MoreMany Rails+React tutorials demonstrate how to create an API only application using Rails, and then create a separate front-end application to digest the API with React. Other React tutorials have you work with something like Firebase to handle the back-end of the application. Although both of these approaches are common and acceptable, I wanted to create an application that has all the benefits of a non API only Rails application, without the limitations and vendor lock-in of a third party service like Firebase.
Read MoreThe Rails Guides give a great example of how to create nested forms. However, Rails does not support adding fields on the fly out of the box. The cocoon Gem is one alternative, as is Ryan Bates’ excellent tutorial. However, both require jQuery which does not ship with Rails 6.
Read MoreRails ships with turbolinks which creates a reactive, fast application. However, there are times when turbolinks is not enough, and you’ll want to roll your own AJAX solutions.
Read MoreThere is currently a high demand for Javascript developers, which in turn dictates the content and curriculum of many tutorials, articles and Boot Camps. Therefore, if you’re new to web development or maybe strictly just a front end web developer, you probably don’t hear a lot about Ruby on Rails these days. I’m here to make a case that Rails is still a very relevant tool in 2019, and should not be overlooked when starting a new project.
Read MoreImagine the following set of models and relationships: A user can add a time_entry to a job. The time_entry has a task, and that task has a rate which depends upon the job. So I need to validate that the associated time_entry on a job is associated with a rate that is also associated with that job. Basically, I want to make sure the correct rate is being applied to the job.
Read MoreThere may be times when you want to customize the column name to be more expressive.
Read MoreIn this tutorial I’m going to show you how to configure your Rails app to use RSpec and Capaybara. In addition, we will also install and configure Factory Bot Rails and Database Cleaner, since these Gems help with a better testing experience.
Read MoreI was tasked with converting a belongs_to association to a has_many :through association. The challenge was that the app was live, and there were existing relationships. I was able to convert the belongs_to association to a has_many :through association while still maintaining existing relationships by creating a custom migration file, and updating the existing models.
Read More