Prasanth Chaduvula

Prasanth Chaduvula

I'm a React, Javascript & Rails full-stack Software Engineer. I have been working remotely for the past two years in a remote village. Before joining as a Software Engineer I founded kwiq - a hyperlocal delivery startup to deliver things in remote villages.
authorImg Prasanth Chaduvula

Rails 7.1 Introduces By Argument For increment_counter And decrement_counter Methods.

With Rails 7.1, we can specify the amount to increment or decrement the value by simply passing the desired number as the `by` argument to increment_counter and decrement_counter.
authorImg Prasanth Chaduvula

Rails 7.1 Adds Rails.application.deprecators Method

Rails.application.deprecators returns a collection of managed deprecators within our application, and allows us to add and retrieve individual deprecators with ease.
authorImg Prasanth Chaduvula

Rails 7.2 Prevents Job Scheduling Within Transactions.

In Rails 7.2, ActiveJob delays job enqueuing until the transaction is committed and drops the job if the transaction is rolled back.
authorImg Prasanth Chaduvula

Rails 7.1 Allows Validators To Accept Lambdas Without Record Argument

With Rails 7.1, we can use lambdas without record argument with ActiveModel validators.
authorImg Prasanth Chaduvula

Rails 7.1 Adds --parent Option To The Controller Generator.

With Rails 7.1, the controller generator now accepts the --parent option. This allows us to generate a controller that inherits from the specified parent class.
authorImg Prasanth Chaduvula

Rails 7.1 Added Support For Array#intersect? To ActiveRecord::Relation.

Rails 7.1 added Array#intersect? method which returns true if two ActiveRecord relation objects have at least one element in common, otherwise returns false.
authorImg Prasanth Chaduvula

Rails 7.1 Raises Error When Generating Model Attributes With Reserved Names.

Rails 7.1 raises error when we generate model with reserved attribute names.
authorImg Prasanth Chaduvula

Understanding `inverse_of` In Rails Associations.

Explore the inverse_of option in Rails associations, highlighting its benefits in performance, data consistency, and optimizing bi-directional relationships.
authorImg Prasanth Chaduvula

Rails 7.1 Adds --unused Option To Detect Dormant Routes.

With Rails 7.1, identify and manage unused routes declared in the application by using bin/rails routes --unused option.
authorImg Prasanth Chaduvula

Rails 7.1 Adds exclude? And extract_value methods To ActionController::Parameters

Rails 7.1 adds exclude?, returning true if a key is missing from parameters. And extract_value, which splits a parameter value by delimiter into an array.
authorImg Prasanth Chaduvula

Rails 7.1 Supports Descending Order For in_batches Without Block

With Rails 7.1, in_batches method without a block works fine for both `ASC/DESC` order values.
authorImg Prasanth Chaduvula

Rails 7.1 Adds after_discard Method To ActiveJob For Discarded Jobs.

Rails 7.1 introduces the after_discard method, allowing us to run a callback when a job is about to be discarded.
authorImg Prasanth Chaduvula

Rails 7.1 Allows Subscribing To ActiveRecord Transaction Events For Instrumentation.

With Rails 7.1, we can subscribe to ActiveRecord transaction events for instrumentation with the help of transaction.active_record.
authorImg Prasanth Chaduvula

Rails 7.1 Adds Adapter Option To Disallow Foreign Keys.

With Rails 7.1, we can disable foreign key constraints for the entire application by adding foreign_keys false option to database.yml
authorImg Prasanth Chaduvula

Rails 7.1 Raises Error On Assignment To Readonly Attributes.

Rails 7.1 now raises an ActiveRecord::ReadonlyAttributeError on assignment to readonly attributes.
authorImg Prasanth Chaduvula

Rails 7.1 Supports Multiple Preview Paths For Mailers.

Rails 7.1 adds support for multiple mailer preview paths, enhancing flexibility and organization by allowing previews across various directories.
authorImg Prasanth Chaduvula

Rails 7.1 Adds Support For Logging Background Job Enqueue Callers.

Rails 7.1 ActiveJob logs background job enqueue callers with backtraces, showing the file and line number where jobs are triggered.
authorImg Prasanth Chaduvula

Rails Adds The Ability To Ignore Counter Cache Columns While They Are Backfilling

With Rails 7.2, we can now ignore counter cache columns during backfilling, allowing faster execution by reducing N+1 queries from counter cache column updates.
authorImg Prasanth Chaduvula

Rails 7.1 Adds Support For Composite Key Multi-Column Ordering In ActiveRecord::Batches

With Rails 7.1, `ActiveRecord::Batches` now supports multi-column ordering for models with composite primary keys, enabling separate ascending or descending order for each key.
authorImg Prasanth Chaduvula

Rails 7.1 Adds *_deliver Callbacks To ActionMailer

With Rails 7.1, we can hook into the lifecycle of email delivery with the help of ActionMailer before_deliver, around_deliver and after_deliver callbacks.
authorImg Prasanth Chaduvula

Rails Warns On Tests Without Assertions.

With Rails 7.2, `ActiveSupport::TestCase` now warns when tests do not run any assertions.
authorImg Prasanth Chaduvula

Rails 7.2 Adds Support For Devcontainer.

In Rails 7.2, use `--devcontainer` flag with `rails new` to add a devcontainer to new apps and run `bin/rails devcontainer` for existing apps.
authorImg Prasanth Chaduvula

Functional Programming In React

Learn about functional programming and how React implements it using immutable data, pure functions, and composition, along with the benefits of functional programming.
authorImg Prasanth Chaduvula

CSS units rem, em, px, vh, vw, percentage

Learn differtent types of css units and their usage based on usecases.
authorImg Prasanth Chaduvula

Understanding Controlled And Uncontrolled Components In React

Learn about controlled and uncontrolled components, the differences between them and and which one to use.
authorImg Prasanth Chaduvula

Rails Adds SKIP_TEST_DATABASE_TRUNCATE Flag To Speed Up Multi Process Test Runs

Speed up multi-process test runs on large DBs with ENV["SKIP_TEST_DATABASE_TRUNCATE"] flag by skipping the table truncations and running test within default transaction.
authorImg Prasanth Chaduvula

Puma-dev And Using It With Rails Applications.

Explore what Puma-dev is, why it is beneficial, how to install and use it, and how to configure it within bin/setup.
authorImg Prasanth Chaduvula

Rails Add ActiveRecord.after_all_transactions_commit Callback

ActiveRecord.after_all_transactions_commit ensures specified actions execute only after all database transactions commit, ensuring reliable post-transaction operations.
authorImg Prasanth Chaduvula

Rails Adds ActiveRecord::Base.with_connection To Optimize Database Operations.

Efficiently manages database connections by promptly returning them to the pool after use, enabling immediate reuse rather than holding onto connections until the end of the request cycle.
authorImg Prasanth Chaduvula

Ruby 3.4 Throws SyntaxError As Keyword Arguments Are No Longer Allowed In Index.

Passing keyword arguments in index to an array set methods throws SyntaxError.
authorImg Prasanth Chaduvula

ActiveRecord::Relation#order Adds Support For Hash Values In Rails 7.2.

With Rails 7.2, ActiveRecord::Relation#order supports hash values where keys are table name, value is a hash of key (column name) and value (order direction).
authorImg Prasanth Chaduvula

PostgreSQL Adapter Now Decodes Columns Of Type Date To Date Instead Of String In Rails 7.2.

Rails 7.2 added a Date decoder to the postgres adapter to type cast dates at the connection level to type cast columns of type date to Ruby Date instead of String.
authorImg Prasanth Chaduvula

Ruby 3.4 Throws SyntaxError While Passing Block As Argument In Index.

Passing a block as an argument in index to an array throws SyntaxError in Ruby 3.4 as it is no longer allowed.
authorImg Prasanth Chaduvula

Strict Loading Using :n_plus_one_only Mode Does Not Eagerly Load Child Associations In Rails 7.2.

In Rails 7.2, with strict loading in :n_plus_one_only mode, associations are eagerly loaded and child associations are lazy loaded.
authorImg Prasanth Chaduvula

Ruby 3.4, Range#size Now Raises TypeError If The Range Is Not Iterable

Range#size raises TypeError if the begin value of Range is a Float or Rational or Beginless.
authorImg Prasanth Chaduvula

Ruby 3.4, No More TypeError With **nil As It Is Treated As An Empty Hash.

When double splat ** operator used with nil, it is treated similarly to **{}, which passes no keywords and does not call any conversion methods.
authorImg Prasanth Chaduvula

Enhancing Data Integrity With validate_foreign_key In Rails

validate_foreign_key validates foreign key constraint and is designed to reduce the impact of adding foreign keys on high-traffic tables in PostgreSQL.
authorImg Prasanth Chaduvula

Rails Adds GitHub CI Workflow By Default To New Applications

All new applications using Rails 7.2 will have GitHub CI workflow by default.
authorImg Prasanth Chaduvula

Rails 7.1 Allows ActiveRecord::Relation#explain To Accept Options

Adding analyze and verbose as ActiveRecord::Relation#explain options give us deeper insight into query performance.
authorImg Prasanth Chaduvula

Rails 7.1 Introduces ActiveRecord regroup Method

With regroup and regroup! methods we can override the group_values
authorImg Prasanth Chaduvula

Rails 7.1 allows resetting singular associations

Query database again to retrieve the associated record by resetting the cache on singular associations.
authorImg Prasanth Chaduvula

Rails 7.1 Introduces Option To Disable All Methods That ActiveRecord.enum Generates

Disable auto generated methods of ActiveRecord.enum with instance_methods by passing false to it.
authorImg Prasanth Chaduvula

Rails 7.1 Adds path_params Option For url_for Helper Method

path_params allows specified params to be used exclusively for named segments under scoped routing without unnecessarily appending parameters to every URL.
authorImg Prasanth Chaduvula

Ruby 3.3 Implements Range#reverse_each Method For Very Large or Beginless Ranges And Error Handling For Endless Ranges

Range#reverse_each can now process beginless ranges with an Integer endpoint and raises TypeError for endless ranges.
authorImg Prasanth Chaduvula

Automate Fly Postgres Database Backup & Store To S3 bucket With GitHub Actions

Discover how GitHub Actions empowers automation to effortlessly backup Fly.io hosted postgres databases, saving backups to a designated S3 bucket.
authorImg Prasanth Chaduvula

Rails 7.1 Allows ActiveRecord reselect Query Method To Accept Hash

Use of hash syntax for specifying columns and aliases with the ActiveRecord::QueryMethods#reselect method makes it easier for querying.
authorImg Prasanth Chaduvula

Ruby 3.3 Introduces Range#overlap? method

Compare two ranges and see if they overlap each other. overlap? returns true if two ranges overlap each other, otherwise false.
authorImg Prasanth Chaduvula

Rails 7.1 Introduces Default Dockerfiles

Dockerfiles facilitate the deployment of Rails applications in production environments using Docker.
authorImg Prasanth Chaduvula

Rails 7.1 Adds ActiveJob#perform_all_later To Enqueue Multiple Jobs At Once

perform_all_later allows us to enqueue multiple jobs that belong to different classes simultaneously within ActiveJob.
authorImg Prasanth Chaduvula

Rails 7.1 Expands ActiveRecord API with Async Query Support

With the Active Record API for general async queries we can efficiently query not so fast queries asynchronously to improve the performance.
authorImg Prasanth Chaduvula

Rails 7.1 Introduces ActiveRecord::Base::generates_token_for

Generate tokens for specific purposes and verify their authenticity.
authorImg Prasanth Chaduvula

Rails 7.1 Introduces ActiveRecord::Base::Normalization

Normalization allows us to define custom normalization rules for attributes in our model. This feature is particularly helpful for ensuring that specific attributes are consistently formatted or transformed before they are saved to the database.
authorImg Prasanth Chaduvula

Rails 7.1 Introduces Autoload Lib and Ignore Sub-Directories with config.autoload_lib(ignore:) Method

Autoloading lib directory isn't always straightforward. In this blog post, we'll delve into the autoloading of the lib directory using config.autoload_lib(ignore:).
authorImg Prasanth Chaduvula

Set And Restore Public Attributes Around a Block Using Object#with

We can use Object#with method as shorthand for the common begin/ensure pattern to save the value of an attribute, setting a new value, and then restoring the previous value.
authorImg Prasanth Chaduvula

React state management - useReducer vs Redux

This blog explores useReducer vs Redux, delving into their definitions, use cases, code samples and when to choose each for efficient state management.
authorImg Prasanth Chaduvula

Open Ranges Are Now Supported By The Object#in? Method In Rails

We can use Object#in? method to check open date ranges i.e. beginless and endless ranges.
authorImg Prasanth Chaduvula

Reduce load times of Rails applications using CloudFront CDN

Delivering static assets and JavaScript files with CDN can significantly improve the performance of our Rails application, resulting in faster load times and a better user experience.
authorImg Prasanth Chaduvula

When to extract code to React custom hooks?

React custom hooks help us to build reusable logic, and make the code more readable. In this blog, we will talk about when and when not to use react custom hooks.
authorImg Prasanth Chaduvula

Rails adds the ability to ignore tables in SQL schema dumps via regular expressions

Ignore tables by configuring regular expressions on ActiveRecord::SchemaDumper.
authorImg Prasanth Chaduvula

Rails now supports routes prefixed with word cable

Rails improved its support for routes which helps us to navigate to routes prefixed with word cable which were throwing 404 errors before.