Subfolders in app/models

Hi,

I have many many models ('cos of SIngle Table Inheritance), and I want
to organize the various subclasses together in subfolders in the
app/models folder.

SO e.g.

app/models/status.rb
app/models/statuses/open.rb
app/models/statuses/closed.rb

This USED to work in an older revision of Rails, but no longer works in
Edge.

How can I make this work, so that Rails automagically recognizes my
subclassed models in the app/models/statuses subfolder … ?

Thanks
Joerg

Joerg D. wrote:

Hi,

I have many many models ('cos of SIngle Table Inheritance), and I want
to organize the various subclasses together in subfolders in the
app/models folder.

SO e.g.

app/models/status.rb
app/models/statuses/open.rb
app/models/statuses/closed.rb

This USED to work in an older revision of Rails, but no longer works in
Edge.

How can I make this work, so that Rails automagically recognizes my
subclassed models in the app/models/statuses subfolder … ?

Thanks
Joerg

You should have a line in your environment.rb that is commented out that
says something about load_paths:

Add additional load paths for your own custom dirs

config.load_paths += ["#{RAILS_ROOT}/app/models/sweepers/"]

Add your custom load paths there.

Works thanks. I was just under the impression that it automatically
includes all subfolders as well … well, that’s how it used to work
anyway. Shot.

Alex W. wrote:

You should have a line in your environment.rb that is commented out that
says something about load_paths:

Add additional load paths for your own custom dirs

config.load_paths += ["#{RAILS_ROOT}/app/models/sweepers/"]

Add your custom load paths there.

It used to. I believe it was removed for security reasons

Joerg D. wrote:
Works thanks. I was just under the impression that it 
automatically
includes all subfolders as well ... well, that's how it used to work
anyway. Shot.

Alex W. wrote:

You should have a line in your environment.rb that is 
commented out that
says something about load_paths:

Add additional load paths for your own custom dirs

config.load_paths += ["#{RAILS_ROOT}/app/models/sweepers/"]

Add your custom load paths there.

  

--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

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