A quick dive into the new query_constraints config introduced in Rails 7.1

The query_constraints config introduced in Rails 7.1 is helpful for pre-setting the DB query constraints on the ActiveRecord models.

Rails 7.1 introduces destroy_association_async_batch_size

Rails 7.1 now allows you to tweak the destroy_async behavior by allowing you to destroy the dependent associations in multiple batches.

Switch email provider at runtime in a Ruby on Rails application

Recently we had a requirement where emails were to be delivered to a specific group of users by switching the provider at run time. In short, we are required to deliver the emails by dynamically selecting a provider and not just through a pre-configured provider. Rails provide these Dynamic Delivery Options to override the SMTP settings per mail. But, if you have an existing application with various mailers, applying delivery_method_options will require updating individual mailer action. In this blog, we'll go through the approaches that will work without modifying any existing mailer actions. Setup Assuming that your default

ActiveRecord attribute encryption in Ruby on Rails for better security compliance

Data Encryption has never been so important to modern-day applications as it is today. Storing personal data in plain-text format makes the application open to data theft. Not only users' personal data is at risk, but even the application becomes subject to scrutiny when it falls under General Data Protection Regulation (GDPR) norms. In this blog post, we will explore a quick way to encrypt & decrypt model attributes using Rails handy ActiveSupport::MessageEncryptor class to ensure compliance such as GDPR. Let's start with some basics on PII and GDPR mandates. Personally Identifiable Information (PII) examples as per GDPR PII

Speed up time-sensitive database process in Rails applications using a Connection pool, Threads, and Arel

Sometimes dealing with DB processes in a Rails application consume a lot of time. Often there are a bunch of small and simple DB queries that go endless. For example, bulk insertions or bulk updates in tables. Dividing it into various background jobs is an idle solution. In a few scenarios, we can't prefer background jobs e.g. the change you apply, makes the existing data invalid. In this article, we will see how to complete a large set of DB queries under minutes which would otherwise take hours if not optimized. It's a better practice to create a rake

Understanding "this" keyword in Javascript & React

This blog helps you understand the 'this' keyword in JavaScript and using it effectively.

Speedup your rake tasks!

I work in a Rails CRM application which has a fairly large number of files (.rb). - To run all the features error free - We need to eager load most files in Development mode!(Ouch!) The app uses Sunspot gem to interact with Solr server. You can start your solr server by the following command rake sunspot:solr:start The Problem Generally if this is a new app - Starting solr through rake does not take more than a few seconds. But here the problem is using rake in our App. Running a rake tasks eager-loads a lot of

Your Chrome Extension in 6 small steps :)

What are extensions? They are small software programs that can modify and enhance the functionality of the Chrome browser. What can extensions do? Extensions can do quite a lot. They use either page actions or browser actions. They can’t use both. A page action is a chrome extension that that responds to permissions provided under manifest.json. You will see it in UI adjacent to google chrome’s address bar. A browser action is not specific to a page and is relevant no matter where you are in the browser Creating a Chrome Extension: 1- You need a folder