It to not raise. It raises cause the 3rd argument to eval() should be a string to the file path
What actually happened
`eval': no implicit conversion of Pathname into String (TypeError)
translations = eval(IO.read(filename), binding, filename)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Versions of i18n, rails, and anything else you think is necessary
What I tried to do
Set
I18n.load_path
toPathname
instances rather than strings. This works for.yml
, but for.rb
files it raises.This came up cause I allowed Rubocop to auto correct a configuration from
config.i18n.load_path += Dir[Rails.root.join("config/locales/**/*.{rb,yml}")]
to
config.i18n.load_path += Rails.root.glob("config/locales/**/*.{rb,yml}")
where
glob
returnsPathname
sWhat I expected to happen
It to not raise. It raises cause the 3rd argument to
eval()
should be a string to the file pathWhat actually happened
Versions of i18n, rails, and anything else you think is necessary
Rails 7.2, I18n 1.14.5
PR with fix coming soon.
Thanks!