Load Paths

#1

Hello ~

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

#{RAILS_ROOT}/app/models/folder_with_more_classes/even_more/maybe_more

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.

Thx,

~ Ben


Ben R.
http://www.benr75.com/
removed_email_address@domain.invalid

#2

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
models
| 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.

Pat