You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
Rails 7.2,
I18n 1.14.5
PR with fix coming soon.
Thanks!
The text was updated successfully, but these errors were encountered:
stevegeek
changed the title
[BUG] Loading RB files with Pathname raises TypeError
[BUG] Loading RB files with Pathname in load_path raises TypeErrorSep 3, 2024
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!
The text was updated successfully, but these errors were encountered: