

Slimmer ActiveModel::Errors#inspect message by lulalala · Pull Request #42832 ·...
source link: https://github.com/rails/rails/pull/42832
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Summary
For ActiveModel::Errors
, only show @errors
array and hide @base
.
@base
is not the core information developers are looking for in an Errors
object, and they would have access to @base
before getting access to errors
anyways.
In the past we would see a very long string, and only to find out at the very end it is empty:
#<ActiveModel::Errors:0x00007ff68cda24f8 @base=#<Foo id: 6, created_at: "2021-07-09 04:28:48.056662000 +0000",
updated_at: "2021-07-09 04:28:48.168576000 +0000", email: "[email protected]", name: "Foo Bar", company: "Foo",
activated_at: "2021-07-09 04:28:39.039853000 +0000">, @errors=[]>
Now it would just be
#<ActiveModel::Errors []>
Or if it is not empty:
#<ActiveModel::Errors [#<ActiveModel::Error attribute=base, type=invalid, options={}>]>
Other Information
I thought since ActiveModel::Errors
is now wrapping around the array, it makes sense to display the information as an array.
Recommend
-
7
All we need is the binaryPublished April 9, 2019 #howto
-
8
Apple's 'iPhone 13' rumored to adopt slimmer TrueDepth notch, flush rear camera module
-
18
MPIRE (MultiProcessing Is Really Easy) MPIRE, short for MultiProcessing Is Really Easy, is a Python package for multiprocessing, but faster and more user-friendly than the default multiprocessing package. It combines the...
-
8
Copy link Member p8 commented...
-
9
Rails 7 introduces ActiveModel::API Oct 13, 2021 , by Alkesh Ghorpade 1 minute read When working with Rails, we are familiar...
-
5
Sony unveils slimmer and lighter PlayStation VR2 and Scene controllers PS5-inspired design By Shawn Knight February 22, 2022,...
-
9
Sixth-Generation iPad Mini to Feature 8.4-Inch Display With Slimmer Bezels, March Launch ExpectedFriday January 8, 2021 8:28 am PST by Juli Clover
-
14
Samsung's M8 is three-quarters slimmer with a "Shades of Nature" inspired color palette Samsung has announced the
-
7
Rails now provides pattern matching support for ActiveModel Jun 8, 2022 , by Keshav Biswa 2 minute read
-
14
Dynomite 2.0 Release: DynamoDB ActiveModel ORM Posted by Tung Nguyen on Dec 11, 2023 I spent a little time on
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK