Skip to content
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

Reorders I18n.load_path #24

Closed
leoarnold opened this issue Oct 19, 2018 · 4 comments
Closed

Reorders I18n.load_path #24

leoarnold opened this issue Oct 19, 2018 · 4 comments

Comments

@leoarnold
Copy link

leoarnold commented Oct 19, 2018

Adding the initializer after :load_config_initializers reorders the I18n.load_path (rails-i18n), giving the default translations from the gem higher priority than my modifications in config/locales.

I have no clue why this is happening, but when I remove the after: :load_config_initializers from the Railtie, everything is normal again.

To emphasize: It seems to be about the position of this gems' initializer, not about what the initializer actually does.

Moreover, inspecting MyApp::Application.instance.initializers.map(&:name) lists grape.middlware.logger actually before load_config_initializers.

@ridiculous
Copy link
Owner

Does the logger and filtered_params get copied correctly from the rails app if we remove the after: option? If so, we don't need it. I think I added it because otherwise the logger was nil

@leoarnold
Copy link
Author

Absolutely. For the time being I vendored your logger into my project and wrote the initializer to a file in config/initializers and it works just fine.

@ridiculous
Copy link
Owner

I see why it's like this: Rails.application.config.filter_parameters isn't set until load_config_initializers step, at least for older Rails versions (<5). It seems to work fine for Rails 5 without the order specified. Fixed on master and will cut a release soon

@ridiculous
Copy link
Owner

Fixed in v1.11.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants