ruby-on-rails Blogs
Written by Kiprosh, team of passionate and disciplined craftsmen turning your ideas into reality.
Kiprosh is now part of LawLytics
Written by Kiprosh, team of passionate and disciplined craftsmen turning your ideas into reality.
In the era of content consumption where streaming platforms like YouTube and Netflix have millions of concurrent users, no one wants to wait more than a minute to consume anything, it must be available instantly! Streaming becomes a need in this situation. While downloading requires waiting until the entire file has been downloaded on your computer, streaming allows you to view downloaded portions of the material on the fly. This significantly reduces the waiting time. Let's see with the help of a small example how streaming was handled before Rails 7 and what changed after Rails 7. With Rails <
In your Rails app, manage third-party API tokens and secret access keys with Rails Encrypted Credentials.
Rails 7 onward zeitwerk mode completely replaces classic autoloader thereby resolving the flaws of classic autoloader
In Rails 7.1 .with query method makes it super easy to build and chain complex Common Table Expression CTE queries.
Rails 7.1 introduces a method authenticate_by, used with has_secure_password to prevent timing-based enumeration attacks.
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 allows to fetch data from multiple databases for a has_many/has_one:through association using the disabled_joins option.
Rails 7 adds ComparisonValidator to compare and validate numeric, date and string values. It provides comparisons options that accept value, procs, or symbol.
This article introduces to GIN index in the Postgres database and how to use it in the Rails application.
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