-
-
Notifications
You must be signed in to change notification settings - Fork 52
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
Rails custom inflection support #81
Comments
We do use Rails inflector:
Can you show me the full backtrace? I guess, that could happen when you try to load the config class before the inflector initializer is loaded. |
@palkan thanks for your answer. I'll have a look on it an may try to create a sample application that have the same issue. |
I try to reproduce it on a rails template but I can't reproduce the issue. In my application, I've the following full backtrace on page loading: Backtrace
I've the issue on both webpage and console. On webpage it's on a specific page that call Payzen API, and so call config file to get credentials. |
I've inspect the code a bit more. anyway_config/lib/anyway/railtie.rb Lines 10 to 13 in 068fdf1
If I'm not wrong, What I've done to try to understand what the code doing is to put a anyway_config/lib/anyway/rails/settings.rb Lines 21 to 37 in 068fdf1
And I notice the following:
Seems the class name already defined, before inflection initializers loaded. |
Thanks for the investigation!
Yeah, we call I suggest configuring inflections in the very beginning of the application boot process, e.g., in your require_relative "initializers/inflections"
module MyApp
class Application < Rails::Application
# ...
end
end |
Added a note to readme: 883c781 |
@palkan thank you for the support! |
What did you do?
I've a config file in Rails application that follow an inflection acronym.
What did you expect to happen?
Code works and load correctly.
What actually happened?
I've got the following error.
Additional context
I suspect eager load not to use rails loader or not the rails inflector.
https://github.com/palkan/anyway_config/blob/master/lib/anyway/railtie.rb#L16
Environment
Ruby Version: ruby 2.7.3p183 (2021-04-05 revision 6847ee089d) [x86_64-linux]
Framework Version (Rails, whatever): Rails 6.0.3.7
Anyway Config Version: 2.1.0
The text was updated successfully, but these errors were encountered: