Rails 7.1 Introduces ActiveRecord::Base::Normalization | Saeloun Blog

03-Nov-2023 1076
Using ActiveRecord::Base::Normalization we can specify unique normalization rules for model attributes. When an attribute is assigned or changed, normalization is applied, and the normalised value is stored in the database.To enable records to be queried using unnormalized values, the normalization is also done to the matching keyword argument of query methods. These rules are applied during data assignment and updates, ensuring that data is stored in a consistent and standardized format in the database.Before Rails 7.1, we could normalize attributes using before_save callback.
Use coupon code:

RUBYONRAILS

to get 30% discount on our bundle!
Prepare for your next tech interview with our comprehensive collection of programming interview guides. Covering JavaScript, Ruby on Rails, React, and Python, these highly-rated books offer thousands of essential questions and answers to boost your interview success. Buy our 'Ultimate Job Interview Preparation eBook Bundle' featuring 2200+ questions across multiple languages. Ultimate Job Interview Preparation eBook Bundle