Namespacing views simply and effectively?


So, to help arrange the files in my application directory, I used a tip
from this blog post:

Essentially, I moved all my controller, model and sweeper files into
folders with names that described their general purpose, and then put a
line like the following in environment.rb:

[“accounts”, “blog”, “support”].each do |path|
[“models”, “controllers”, “sweepers”].each do |component|
config.load_paths += %W( #{RAILS_ROOT}/app/#{component}/#{path} )

This worked out pretty well. Now, I want to figure out a way to do the
same with views. I’ve experimented a bit with putting them in the same
folders, under app/views, and pointing to them like:

before_filter { |controller| controller.view_paths = [“app/views/blog”]

But this gets very messy - Rails starts looking for layouts and partials
in the same place, even though those are shared among different parts of
the site and shouldn’t be namespaced.

Does anyone have a suggestion? I have an annoyingly large number of view
folders and files, and I want to neaten them up a bit.



Nobody has any ideas?