views:

30

answers:

1

I have a rails 3 app that has 2 different UIs that both share the same model but have different UIs. Lets call these retailers and customers "sites". What is the best approach in rails 3 for creating a monolithic application to keep these two apps in one app. Should I just namespace the controllers, and change routing as such?

namespace "retailers" do resources :posts, :comments end

namespace "customers" do resources :posts, :comments end

and place all the customer controllers in customers directory and likewise for retailers? and namespace the view directories as well?

+1  A: 

Yes, I would recommend putting the two different resources in separate namespaces.

In addition I would make two separate base controllers for retailers and customers, e.g. RetailerController and CustomerController and then make all respective controllers inherit from these.

You probably might want to put the customers into the root namespace, i.e. a regular customer could access your site at http://myshop.com but the retailers (who you probably can instruct better) would have to to go http://myshop.com/retailers

Wolfgang
thanks for the helpful response wolfgang
Ranchersam