Ruby on Rails - February 2024
Ruby on Rails Monthly | February 2024 | Sajjad Umar

Ruby on Rails - February 2024

Greetings,

As we dive into the February edition of the "Ruby on Rails, Monthly" newsletter for 2024, let's infuse our coding journey with a touch of warmth and affection. I hope this month brings you renewed inspiration and a deep appreciation for the craft of Rails development. I'm Sajjad Umar, your DesiDeveloper, and I'm thrilled to continue exploring the ever-evolving world of Ruby on Rails with you. Let's embark on this month's adventure with passion and excitement!

CFP For RailsWorld Are Now Open

Today Rails is stronger than ever thanks to continued progress in both core frameworks, like Active Record and Action Mailbox, as well as associated tools and frameworks, like Hotwire, Kredis, and Propshaft.

This time we will especially be on the lookout for original talks that fall into a few specific themes:

  • Support for the features coming in Rails 8
  • Rails as the One-Person Framework
  • And on the other end of the spectrum: Rails at Scale
  • The competitive advantage of Rails, whether that is the ease of building with the leanest of teams, its stability over time, or simply the joy and fun of working with it on creative side projects

Talks submitted should be max 30 minutes long, and there is space for 24 talks in the agenda, including 4 invited keynote spots.

The call closes at 11:59 PM on 21 Mar 2024

Read all the details here.

Rails Documentation Improvement has Begun

Acknowledging the already impressive state of the documentation, the foundation aims to review, update, and enhance it further. The process involves an audit of the documentation, followed by writing, team review, PR creation for community input, and eventual merging. The community is invited to participate by reviewing PRs labeled 'RF-DOCS' and 'rails foundation', providing technical feedback, and opening issues labeled 'docs' for areas needing improvement. Existing contributors are encouraged to continue their contributions, as the project complements rather than interrupts ongoing documentation efforts.

Read about the entire process here.

Read all about the changes made so far here.

Resolved Missing IPAddr Prefix in Msgpack Cache Serialization

This Pull Request has been created because we noticed the msgpack serializer missing the prefix(netmask) data of the IPAddr object when dumped.

This PR fixes the issue.

Read all the details here.

Rails Default Load Paths Now Limited to Directories

Files such as app/README.md should not be in the autoload paths. This PR removes files from the default load paths set up by the Rails framework.

Although File.stub(:exist?, true) in the existing test has been changed to File.stub(:directory?, true), it is obvious that this does not break the objectives of the test.

Read all the details here.

Implemented Customized Prompt for Rails Console

The rails console's prompt is not easily distinguishable from the normal IRB console. It also doesn't provide Rails-specific information to assist developers.

There were 2 more follow-up PRs on this:

The combination of red and blue is more color-blind friendly than red and green. And Instead of displaying [env]:[line-number]> as the prompt, showing [app-name]([env])> provides more value to the user.

For example, if the app's top-level module is MyApp, its development prompt would be:

my-app(dev)>        

After making all the changes the console now looks like this:

Source: GitHub

Read all the details here.

schema_dump, query_cache, replica and database_tasks are now configurable via DATABASE_URL

In database.yml, schema_dump can currently be set to false, nil or a file path.

If you configure your database via DATABASE_URL, the false value does not work because it comes through as a string.

This PR fixes this and all other boolean configs, not just schema_cache.

Read all the details here.

Fixed rotation detection for HDR videos

The video analyzer relied on the positional reference of side_data to fetch the rotation metadata. However, the side_data is not guaranteed to be in the same position for all videos. For instance, HDR videos shot on iOS in portrait mode have "DOVI configuration record" side_data in the first position, followed by the "Display matrix" side data containing the rotation value.

This fix removes the positional reference and explicitly searches for the "Display Matrix" side_data to retrieve the rotation angle.

Read all the details here.

Consistent ArgumentError for Invalid Nested Attributes Arguments

This PR Updates ActiveRecord::NestedAttributes#assign_nested_attributes_for_one_to_one_association to raise an ArgumentError when given an invalid attributes argument similar to ActiveRecord::NestedAttributes#assign_nested_attributes_for_collection_association.

Also makes a slight improvement to the existing error for collection associations.

Read all the details here.

ActiveRecord::DelegatedType changes

While dealing with strong parameters in API requests and validating the polymorphic type field for a delegated type in a slightly abstract manner, it is useful to have access to the allowed types.

This Pull Request changes the methods defined by ActiveRecord::DelegatedType

Read all the details here.

Deprecated passing nil as model arg instead of raising ArgumentError

This Pull Request removes the changes introduced in (Handle nil form_with model argument #49943) since these changes are breaking changes. Instead, we will first deprecate the current default value of the model: argument in form_with.

Read all the details here.

Skiped CSS when creating APIs

This Pull Request has been created because Tailwind CSS was included when generating APIs. This Pull Request changes the behavior of skipping CSS for APIs.

Read all the details here.

Commented-out lines in .railsrc file should not be treated as arguments

This Pull Request changes Railtie ARGVScrubber to ignore text after # symbols.

Read all the details here.

Added row_count field to sql.active_record notification

This Pull Request modifies *Adapter.log, which emits sql.active_record notifications. Previously, the instrument call only logged information within a request but allowed modification of the payload by the caller within the block. The change adds a new field to each sql.active_record notification, indicating the number of result rows returned in each query. This enhancement enables consumers of the notification to utilize this metric. The PR also includes three tests in the instrumentation test suite to verify functionality for various types of queries.

Read all the details here.

Allowed encryption without compression

Added a compress option to ActiveRecord::Encryption::Encryptor, which defaults to true. When set to false, the encryptor will never compress the data.

This can be used with the encryptor option in the model:

class Record < ApplicationRecord
  encrypts :field, encryptor: ActiveRecord::Encryption::Encryptor.new(compress: false)
end        

Read all the details here.

Properly synchronized Mysql2Adapter#active? and TrilogyAdapter#active?

Connections must not be shared between threads but it is required when running transactional tests or system tests and could lead to a SEGV.

This PR properly synchronizes Mysql2Adapter#active? and TrilogyAdapter#active? As well as disconnect! and verify!.

Read all the details here.

Fixed JSON-encoding ActiveStorage::Filename

ActiveStorage::Filename was missing quotes when encoded, generating invalid JSON like this:

JSON.generate(foo: ActiveStorage::Filename.new("bar.pdf") # => '{"foo":bar.pdf}'        

This PR Delete to_json and rely on the implementation from ActiveSupport::ToJsonWithActiveSupportEncoder.

Read all the details here.

Enhanced Query Log Tags with :source_location Option

This PR adds support for showing where a query is defined in the Rails logs when using Active Record Query Logs.

Read all the details here.

Optimized Memory Allocation with Default Dockerfile Setup of jemalloc

Ruby's use of malloc can create memory fragmentation problems, especially when using multiple threads like Puma does. Switching to an allocator that uses different patterns to avoid fragmentation can decrease memory usage by a substantial margin.

Read all the details here.

Implemented Rails::TestUnitReporter#prerecord

Minitest's pre-test invocation enables printing the test name beforehand, aiding in debugging slow or stuck tests, particularly in verbose mode. This feature helps identify stuck tests before deadlock occurs, eliminating the need for cumbersome workarounds to pinpoint the problematic test. Additionally, this mechanism aligns with the default behavior of Minitest's reporter in verbose mode.

Read all the details here.


Desi Developer

Really exciting update, I have completed 9 chapters of my book “Ruby on Rails for Web Development“. 3 more to go, the goal is to publish it around the end of March 2024!

That is it for this month’s edition of Ruby on Rails monthly. As I conclude this February edition of the "Ruby on Rails, Monthly" newsletter, I want to extend my sincere gratitude for your continued support and engagement. Your enthusiasm fuels my passion for Rails development, and I'm truly grateful for the opportunity to be part of this vibrant community. As I strive to bring you even more valuable content and insights in the coming months, I kindly invite you to consider upgrading to a paid subscription on Substack to support the growth of this free newsletter. Your contributions help me maintain the quality and frequency of our updates, ensuring that I can continue delivering top-notch content to you and fellow Rails enthusiasts. Thank you for being part of this journey, and here's to many more exciting discoveries in the world of Ruby on Rails!

Subscribe now

Until we meet again ??

If you are a paid subscriber already thank you for making this newsletter sustainable and helping out the community.

Akbar Hafeez Butt

Backend Developer | .NET Web API | Software Engineer

1 年

要查看或添加评论,请登录

Sajjad Umar的更多文章

  • Ruby on Rails?—?March 2025

    Ruby on Rails?—?March 2025

    All the Rails News That Matters, Once a Month. Ramadan Kareem! ?? Wishing you all peace, blessings, and a month filled…

  • Ruby on Rails - Feb 2025

    Ruby on Rails - Feb 2025

    All the Rails News That Matters, Once a Month. Hey everyone—Sajjad Umar here with the February edition of Ruby on Rails…

  • Ruby on Rails — Jan 2025

    Ruby on Rails — Jan 2025

    All the Rails News That Matters, Once a Month. Happy New Year, everyone! ?? This is Sajjad Umar, kicking off 2025 with…

  • Ruby on Rails?—?Dec 2024

    Ruby on Rails?—?Dec 2024

    It's the only Ruby on Rails newsletter you will ever need! Hey guys?—?this is Sajjad Umar back with another edition of…

  • Ruby on Rails - Nov 2024 (Edition #35)

    Ruby on Rails - Nov 2024 (Edition #35)

    Welcome to the 35th Edition of Ruby on Rails Monthly - Sajjad here with some exciting updates from Ruby on Rails world.…

  • Ruby on Rails - Oct 2024

    Ruby on Rails - Oct 2024

    The only Ruby on Rails newsletter you will ever need! Hey Ruby folks?—?this is a fascinating month for the Ruby on…

    1 条评论
  • Ruby on Rails - September 2024

    Ruby on Rails - September 2024

    Welcome to the September 2024 edition of Ruby on Rails Monthly, this is Sajjad Umar your own Desi Developer. I have a…

    1 条评论
  • Ruby on Rails - Aug 2024

    Ruby on Rails - Aug 2024

    It's the only Ruby on Rails newsletter you will ever need! Rails 7.2 is out! There has been close to 2,500 commits made…

  • Ruby on Rails - July 2024

    Ruby on Rails - July 2024

    The only Ruby on Rails newsletter you will ever need! Welcome to the latest edition of the Ruby on Rails Monthly…

  • Ruby on Rails?—?June 2024

    Ruby on Rails?—?June 2024

    The only Ruby on Rails Newsletter you will ever need! Welcome to the latest edition of the Ruby on Rails Monthly…

社区洞察

其他会员也浏览了