-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use squish
rather than strip_heredoc
#25668
Use squish
rather than strip_heredoc
#25668
Conversation
r? @eileencodes (@rails-bot has picked a reviewer for you, use r? to override) |
Thanks, but |
Originally, this error message was written by raise ActiveRecordError,
"cannot touch on a new or destroyed record object. Consider using " \
"persisted?, new_record?, or destroyed? before touching" This PR fixes to inspect the error. Before:
After:
|
--- a/activerecord/test/cases/touch_later_test.rb
+++ b/activerecord/test/cases/touch_later_test.rb
@@ -12,9 +12,10 @@ def test_touch_laster_raise_if_non_persisted
invoice = Invoice.new
Invoice.transaction do
assert_not invoice.persisted?
- assert_raises(ActiveRecord::ActiveRecordError) do
+ e = assert_raises(ActiveRecord::ActiveRecordError) do
invoice.touch_later
end
+ p e
end
end
|
https://github.com/rails/rails/blob/v5.0.0/activerecord/lib/active_record/reflection.rb#L409-L413 raise ArgumentError, <<-MSG.squish
The association scope '#{name}' is instance dependent (the scope
block takes an argument). Preloading instance dependent scopes is
not supported.
MSG |
Lots of our other error messages use |
@kaspth got some examples? I only see a few, all of which are using the line breaks for structure, rather than word wrapping. OTOH, I don't like this message anyway, so... 😕 |
See also #23838. |
…redoc Use `squish` rather than `strip_heredoc`
Backported in 6c0fd9f |
@matthewd right you are, that was used for structure. All good here 👍 |
No description provided.