template paths and view paths with namespaced controllers?


So I've got a confusing situation... I've got some controllers namespaced by account types, for example "Buyer" and "Seller". I want to have some controllers in either namespace look in a common directory first for views and then within their namespaced views. I can't figure out how to do this, though. I can set a global before_filter and append or prepend to the view_path. For example, if I have:

Seller::UsersController < ApplicationController   def index   end end

Then I get:

Missing template seller/users/index.html.erb in view path .../ myrailsapp/app/views:/...myrailsapp/app/views/common

See the problem? It's looking in "seller/users", not just "users", so even if I move the code into app/views/common, it would need to be in "app/views/common/sellers/users/" which doesn't make it common across sellers and buyers.

What I'm trying to do is have the above scenario use a view path as: [/app/views/sellers/users/, /app/views/common/users/]

That way, I can put common code in common for user views across the namespaces, but then if I want, I can put a view in the namespaced path and it will pick that up first.

I'm assuming (hoping?) there's some way to tell a namespaced controller to not look in the namespaced view path?

Thanks for any help anyone can provide,


As added info, it's really not a view path problem, but a template path problem, as I see it. When in a namespace, Rails appends the folder for the namespace to template calls by default. So what I'm trying to do is find a way to override that. I know that I can just do a:

render :template => "users/index"

and if my view_path is set as:

[/app/views/sellers/, /app/views/common/]

Then it would work... but then I'd have to _explicitly_ call the render :template call for EVERY action in my controller within the namespace.

I'm gonna go read up on render and see what I can find.

I welcome input here. :slight_smile: