Boring authorization in rails
In this article, we look a how we can add authorization to a Rails app without the need to add a gem. The goal is to keep things simple, ship fast, and avoid dependency hell.
I am Moses Gathuku, an experienced Ruby on Rails product developer. I help businesses and individuals build and lunch fully-fledged products and MVPs. Apart from day-to-day work with different clients, I work on my side projects. Currently am building Hotwired cases a collection of Hotwire use cases in a Ruby on Rails application.
In this article, we look a how we can add authorization to a Rails app without the need to add a gem. The goal is to keep things simple, ship fast, and avoid dependency hell.
This is mostly applied in typehead searching, when a user is typing you can listen to the input event and submit a form that returns search results from the server.
In rails, it is possible to specify when the validation should happen. sometimes you may want to introduce new validation or skip some. Rails `on` option helps us achieve this.
Rails provide us with useful test helpers to ActionMailer which helps to easily iterate our design, test if our code queues the right email and our email contains the right content.
Running external APIs tests can be time-consuming, VCR is a ruby gem that allows you to record test suite's HTTP interactions and replay them during future test runs for fast, deterministic, accurate tests