-
-
Notifications
You must be signed in to change notification settings - Fork 411
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
Revert #591, add a regression test for #617 #620
Conversation
@jeffblake I've just confirmed in that test application that:
No longer makes this issue appear. As it's currently the weekend (or soon to be) in most places of the world, and I am cautious about releasing a new version and disrupting people's weekends, I will be holding off on committing + releasing this one until Tuesday morning Australian Eastern Time. |
It appears that the issue is with This change to ActiveModel would also fix this issue, and allow for #591 to be added back into I18n: diff --git a/activemodel/lib/active_model/naming.rb b/activemodel/lib/active_model/naming.rb
index 72a3e43e71..2b7f02fd0b 100644
--- a/activemodel/lib/active_model/naming.rb
+++ b/activemodel/lib/active_model/naming.rb
@@ -205,7 +205,7 @@ def human(options = {})
defaults << options[:default] if options[:default]
defaults << @human
- options = { scope: [@klass.i18n_scope, :models], count: 1, default: defaults }.merge!(options.except(:default))
+ options = { scope: [@klass.i18n_scope, :models], count: 1, default: defaults.dup }.merge!(options.except(:default))
I18n.translate(defaults.shift, **options)
end However, I no longer make contributions to Rails code itself, after bad interactions with a particular person on the core team. |
Thanks @radar ! That branch fixes it. |
@radar Understandable. Sorry you had to go through that. |
defaults = [:"product/ticket", :product, "Ticket"] | ||
options = {:scope=>[:activerecord, :models], :count=>1, :default=> defaults} | ||
assert_equal("Ticket", I18n.t(defaults.shift, **options)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
defaults = [:"product/ticket", :product, "Ticket"] | |
options = {:scope=>[:activerecord, :models], :count=>1, :default=> defaults} | |
assert_equal("Ticket", I18n.t(defaults.shift, **options)) | |
defaults = [:product, "Ticket"] | |
options = {:scope=>[:activerecord, :models], :count=>1, :default=> defaults} | |
assert_equal("Ticket", I18n.t(:"product/ticket", **options)) |
@radar To be clear before I say other things: I'm fine with the revert, but disagree with that regression test as written. I've added a suggestion to fix it. I reviewed the proposed fix to Rails, and while I agree that works as a workaround, I disagree that's the solution to the problem. I think it makes sense that they don't provide the original #591 is incorrect, since I didn't check/realize that
Prior to #591, there was no distinction between the cases. #591 should have introduced that distinction. I'll look into what can be done and open a replacement to #591 (Update: replacement PR is here) |
After #591, and with I18n v1.9.x versions, the fallbacks logic has broken. In this PR, I include a simple test to reproduce the issue as well as reverting #591.
cc @movermeyer / @jeffblake