Newbie question: subdirectories in app/models

For organizational purposes, I would like to create subdirectories in
my apps/model/ directory. Is there any easy way to do this while
still having the ability to refer to the derived active record class
models?

I.e.
apps/models/blog/post.rb:
class Post < ActiveRecord::Base

end

Post.new …

Scott T.

Scott T. wrote:

For organizational purposes, I would like to create subdirectories in
my apps/model/ directory…

Google says: http://myles.eftos.id.au/blog/archives/15

I don’t think the question was about subdirs for controllers.

You can have app/models/subdir/post.rb and Rails will load Post in the
normal way. But this can lead to namespace conflicts if you have another
post.rb someplace, so I would use it sparingly.

HTH,
Jeff

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