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

11 views
Skip to first unread message

Walter Lee Davis

unread,
Aug 24, 2015, 1:33:36 PM8/24/15
to Ruby on Rails: Talk
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 there be any sense in trying to tease it out, or make a work-around configuration 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 to `_`, and then interpreted as the inverse later. Meaning is inferred where none should exist.

Walter
Reply all
Reply to author
Forward
0 new messages