Prepare initializers for Rails 6#4462
Conversation
cd29e98 to
5f9858f
Compare
app/models/user.rb
Outdated
There was a problem hiding this comment.
The new relic tracer moves are unfortunate, but I'm not sure we can reference model classes in initializers in the way we were previously.
5f9858f to
6a7b521
Compare
zachmargolis
left a comment
There was a problem hiding this comment.
LGTM, a couple of small comments
app/models/identity.rb
Outdated
| IAL1 = 1 | ||
| IAL2 = 2 | ||
| IAL2_STRICT = 22 | ||
| IAL_MAX = Idp::Constants::IAL_MAX |
There was a problem hiding this comment.
What if we removed the constants definitions here and updated refs to Identity::IAL1 etc to Idp::Constants::IAL1?
There was a problem hiding this comment.
I waffled on that, but will update to use Constants everywhere
| module Idp | ||
| module Constants |
There was a problem hiding this comment.
can we make the file match autoloading expectations even if it's not autoloaded? lib/idp/constants.rb or IdpConstants as the module name?
| @vendors = nil | ||
|
|
||
| class << self | ||
| def validate_vendors! |
There was a problem hiding this comment.
heads up this may conflict if my PR merges first: https://github.com/18F/identity-idp/pull/4464/files#diff-23e1ebd0b7b589abb3a8a3b5f9f0536eb8ab6c41499b1b0dfad67cc58d9100b3
Autoloading in Rails 6 is getting stricter to fix some inconsistencies in how files are initially loaded and reloaded. The short version is anything used in an initializer can't be reloaded properly. More detailed descriptions are here and here.
This PR moves some of the code used in initializers to
lib/, which is not reloaded, along with a few other fixes.