Rails.application infers nested structure from an underscore in the app name

Can anyone explain this to me? If I name a project foo_bar, and use
‘Rails.application’ as a root for configuration paths or similar, I will
end up with a cryptic error on some operations. The fix is to make all
references to the application using ‘FooBar::Application’ in place of
‘Rails.application’, but what is it that makes this happen, and would
be any sense in trying to tease it out, or make a work-around
where you could set the expected alias once, rather than replacing the
useful shortcut everywhere it is used?

It appears to be part and parcel with the bits of code that recognize an
Engine, and namespace its operations based on the path. / gets changed
_, and then interpreted as the inverse later. Meaning is inferred
none should exist.


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs