Manage Rails app secrets with Rails Encrypted Credentials

In your Rails app, manage third-party API tokens and secret access keys with Rails Encrypted Credentials.

Autoloading pitfalls fixed by Rails 7’s default Zeitwerk mode

Rails 7 onward zeitwerk mode completely replaces classic autoloader thereby resolving the flaws of classic autoloader

Rails 7.1 - construct Common Table Expression using .with query method

In Rails 7.1 .with query method makes it super easy to build and chain complex Common Table Expression CTE queries.

Rails 7.1 adds authenticate_by when using has_secure_password

Rails 7.1 introduces a method authenticate_by, used with has_secure_password to prevent timing-based enumeration attacks.

Advanced features provided by the new debug gem in Ruby

debug is Ruby's new default debugger included in Ruby 3.1. This new debugger has replaced byebug in Rails 7. Not only does debug provide us with a wide range of functionality, but it also provides some advanced features. In this article, we will explore and understand a few advanced features of debug. 1. Seamless integration with VSCode Below steps can be followed to integrate debug gem in VSCode. Install extension VSCode rdbg Ruby Debugger - Visual Studio Marketplace in your VSCode.Open the file you want to debug in the VSCode.Register the breakpoint by clicking on the line

Rails 7 - Associations across databases with disable_joins

Rails 7 allows to fetch data from multiple databases for a has_many/has_one:through association using the disabled_joins option.

Rails 7 introduces ComparisonValidator to compare data with validation

Rails 7 adds ComparisonValidator to compare and validate numeric, date and string values. It provides comparisons options that accept value, procs, or symbol.

Postgres GIN Index in Rails

This article introduces to GIN index in the Postgres database and how to use it in the Rails application.

Deep dive into ActiveRecord .scoping method in Rails

In Rails, multiple scopes can be created and chained together. What if we wish to apply a specific scope to a group of queries? Consider the following scenario: we have Post and Comment models and we want to perform few operations on public posts. # app/models/post.rb class Post < ActiveRecord::Base scope :public, -> { where(private: false) } endLoading development environment (Rails 7.0.0.alpha2) 3.0.0 :001 > Post.public.update_all(body: 'public post') Post Update All (4.1ms) UPDATE "posts" SET "body" = ? WHERE "posts"."private" = ? [["body", "public post"], ["private", 0]] 3.0.0

Rails 7 introduces partial_inserts config for ActiveRecord

Rails 7 adds the partial_inserts config to config.active_record that is used to control partial writes when creating a new record. config.active_record.partial_inserts is a boolean value and controls whether or not partial writes are used when creating new records (i.e. whether inserts only set attributes that are different from the default). Configuring config.active_record.partial_inserts In a newly created Rails 7.0 application, config.load_defaults 7.0 is set by default in application.rb. The default value of partial_inserts for config.load_defaults 7.0 is false and for