Forum: Ruby on Rails Namespacing views simply and effectively?

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.
Chris H. (Guest)
on 2009-06-05 02:35
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.

Chris H. (Guest)
on 2009-06-05 23:13
Nobody has any ideas?
This topic is locked and can not be replied to.