Blog

Thoughts from my daily grind
Posted by Ziyan Junaideen 19 August 2023
UUID v7 overcomes the limitations of v4 by including an 48 bit epoch timestamp along side random data. Here we discuss how you can enable UUID v7 on PostgreSQL and use it on a Ruby on Rails project.
Posted by Ziyan Junaideen 25 June 2023
Introduction to RSpec Request Specs and how you can use it in your Ruby on Rails application.
Posted by Ziyan Junaideen 15 April 2023
DRY your test code by generalizign repetitive tests in to RSpec shared examples.
Posted by Ziyan Junaideen 11 March 2023
Not everyone has the luxury of having a beefed-up MacBook. I have wondered if 8GB of RAM will be sufficient for my work, and the answer is yes. But I do recommend at last 16GB.
Posted by Ziyan Junaideen 12 February 2023
Install and manage multiple versions of Ruby using the ASDF. ASDF allows you to manage multiple runtimes in one tool. I use it for Ruby, Elixir/Erlang and Node JS.
Posted by Ziyan Junaideen 14 January 2023
Rswag is a useful tool when it comes to documenting an API that is both OpenAPI and Swagger compatible. Here we discuss how we can work around unsupported attributes like servers.
Posted by Ziyan Junaideen 07 January 2023
ArgumentError: Missing host to link to is an error that has bugged me for over ten years. This post covers how you can set default URL options for routes in a Rails application.
Posted by Ziyan Junaideen 26 October 2022
Fix Library not loaded: /usr/local/lib/libpq.5.4.dylib error after you upgrade your Homebrew packages.
Posted by Ziyan Junaideen 07 October 2022
VCR is a tool that can be of immense help for developers testing against 3rd party APIs. This post discusses how to track down unused VCR cassettes for remvoal.
Posted by Ziyan Junaideen 22 July 2022
Delegation is a commonly used in software design to enforce the Law of Demeter. This article discusses how we can delegate methods in Ruby (using the standard library) and also using Rails.
Posted by Ziyan Junaideen 06 June 2022
The "NSCFConstantString initialize error" bugged me right after a macOS Monterey installation on a Ruby on Rails v7 project. The solution is quick and simple. Why it happens though is a curious matter I would leave for later.
Posted by Ziyan Junaideen 04 June 2022
Enums are a useful and commonly used data type in Ruby applications. Rails 7 introduces support to create native PG enum data types. This post discusses the creation and use of native enums with PostgreSQL, advantes & disadvantages.
Posted by Ziyan Junaideen 18 May 2022
If you are testing RoR mailer views using RSpec and FFaker gem, you could randomly experience match failures. This post explains how you can use HTML escape to bring escape the name before matching.
Posted by Ziyan Junaideen 19 April 2022
gRPC, a remote-procedure-call framework by Google, is by far one of the preferred RPC frameworks in the wild. Here is a comparison between gRPC and JSON HTTP APIs for interconnecting services.
Posted by Ziyan Junaideen 14 April 2022
A Ruby developer will often require to work with different versions of a Ruby gem. This article discusses the installation and use of a ruby gem with a specific version in the terminal.
Posted by Ziyan Junaideen 13 April 2022
A little advice from my encounter with the LinkedIn Skill Assessment Test for Ruby on Rails. It is an easy test and any Rails developer could easily land on a new shiny badge.
Posted by Ziyan Junaideen 02 April 2022
Not every model/database table requires an auto-increment integer field as the primary key. Ruby on Rails allows us to specify the primary key in the migration field and configuration in the model.
Posted by Ziyan Junaideen 28 March 2022
Ruby on Rails doesn't add model field details to the model and related files such as specs and factories. The annotate library automatically adds field definitions to relevant files.
Posted by Ziyan Junaideen 28 March 2022
The popular Ruby on Rails library ActsAsTaggableOn wrongfully selects the parent class in STI resulting empty #tagged_with method output. The solution would be to use a custom query.
Posted by Ziyan Junaideen 11 March 2022
Bring life to your Rails application by using Toastr alerts with Turbo and Stimulus JS. This blog post details the steps with code samples to show Toastr flash messages.
Posted by Ziyan Junaideen 25 November 2021
Enable Tailwind CSS with JIT in your Ruby on Rails project using the new `cssbundling-rails` ruby gem. Includes advice for Trailblazer configuration.
Posted by Ziyan Junaideen 24 September 2021
The Cookie Consent prompt negatively affects the effectiveness of landing pages. I recommend you disable them unless necessary. This is how you can disable sessions on routes on your Rails website.
Posted by Ziyan Junaideen 29 May 2021
Those who enjoyed the where.not(...) query method will surely find the query.invert_where query method a welcoming feature. It allows us to easily invert entire queries.
Posted by Ziyan Junaideen 18 April 2020
Bring sanity to your code and avoid massive expectation pyramids by chaining multiple conditions inside a single `expect` block.
Posted by Ziyan Junaideen 02 January 2020
The Ruby-retry method allows us to effortlessly retry a met a code block or an error handled method when an error is raised. This posts explains the retry method with an example use.
Posted by Ziyan Junaideen 24 August 2019
Learn how you can track an ActiveRecord objects attribute changes across its lifecycle or page request. The methods [attr]_was, [attr]_chagned?, [attr]_previously_was are some among the helpful methods implemented in ActiveModel::Dirty module.
Posted by Ziyan Junaideen 16 July 2016
With the introduction of ActionCable with Rails 5.0, WebSockets are now first-class citizens in the Ruby on Rails ecosystem. This article is an introduction to the WebSockets implementation in Rails.
Posted by Ziyan Junaideen 08 March 2016
Caching is a vital instrument to reduce the load on the server and deliver reused results and speed up page load for the user. Rails 5 introduces collection caching that can vastly improve performance.