Forum: Ruby on Rails Load Paths

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
D90ef6808433e63203e15a5c2dadb0bb?d=identicon&s=25 benr (Guest)
on 2005-12-02 03:39
(Received via mailing list)
Hello ~

I was under the impression that Rails looped through the folders in
your app adding classes dynamically. For example I have:


After moving my files into these folders, our app died.  I got it to
work again by adding the paths to the environment.rb in the
config.load_paths.  Is there an option I am missing which will do this
automatically?  My load_paths is going to get very long.


~ Ben

Ben Reubenstein
42172acdf3c6046f84d644cb0b94642c?d=identicon&s=25 Pat Maddox (pergesu)
on 2005-12-02 03:43
(Received via mailing list)
I'm not totally sure on this, but I *think* that Rails assumes that if
you have a model in a subfolder, then it's part of a module.  For
example, if you have a layout like
    | subfolder
         | MyModel.rb

Then you would need to change the class declaration in MyModel.rb to
subfolder::MyModel, because Rails will think that MyModel is in the
'subfolder' namespace.

As I said, I'm not sure about this, but I think that's the case.

This topic is locked and can not be replied to.