Open bobmaerten opened 5 years ago
I talk about the problem with friends and it seems other gems can trigger the same problem though. I'll reference this problem in authlogic repo too.
Seems the boot problem came from old code in authlogic. Nonetheless the part about lazy setup is still relevant.
Context
Hi, I have a project using https://github.com/binarylogic/authlogic and I had trouble to get it running in production, because of a railties setup problem:
ActionController
was required before the authlogic lazy setup could trigger.Why I think it's lograge related?
Because I checked all my gems by disabling them individually. And when I disable lograge, everything runs fine.
Digging further, I found out that the culprit was an initializer invoking Lograge
custom_payload
.demo-app
https://github.com/bobmaerten/authlogic_rails_adapter_loaded_to_late
I've set up an example application which trigger an error with authologic when precompiling production assets with a configured Lograge initializer (same effect when config is placed in
config/environment/production.rb
)Running assets precompilation fails:
When removing
config/initializers/lograge.rb
or block inconfig/environment/production.rb
or even simple usage ofconfig.lograge.custom_payload
from those files.What did I do to make the whole gems work together?
We managed to split the configuration from the initializer to production environment file and ApplicationController by overriding the rails
append_info_to_payload
method as suggested in the documentation.With this setup, it works. With the documented
custom_payload
it's not.Trying to find what is not working
Authlogic just got upgraded to 5.0.3 with a change in its
ActionController
setup.I'm not super fluent in railties, but Lograge seems not use the rails setup best practise, and instead juste requiring rails components like this https://github.com/roidrage/lograge/blob/397c830208a7ec1601c0eacc0dddd09274afff5b/lib/lograge/railtie.rb#L1
May be you could replace the code with something like
or may be just drop the
custom_payload
example from the documentation?