Rails

Sort Your Rails Models By The Order of their Associations

Sort your Rails models by the order of their belongs_to associations using ActiveRecord::Reflection.

Rails 7.1 now allows matching exception messages to assert_raises assertion.

Check the exception and the message raised by rails or custom errors in tests together with assert_raises in a single line.

picture_tag helper in Rails

Support for picture_tag helper in Rails. Its usage, advantages, and use cases.

Rails.env.local? in Rails 7.1

Rails.env.local? was introduced in Rails 7.1. This post explores its usage.

Rails 7.1 extends enum support for Postgres adapter

Rails 7.1 extends support to rename enum, add enum value and rename enum value for Postgres adapter

Using quarter method by rails 7.1

Get quarter of the date provided for the current year or the custom year.

Shaping Rails to Your Needs, Customizing Rails Generators using Thor Templates

Templates are an easy way to customize your Rails generators to fix repetitive tasks and make your life easier.

Extract Sample Rate of an Audio File with Audio Analyzer in Rails 7.1

Extract the sample rate of an audio file with ActiveStorage::AudioAnalyzer which will return the bit rate, duration, and sample rate

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.

Adding table names to error for duplicate column names

Table name is shown in the error when duplicate columns for the same table is entered while creating it.