views:

59

answers:

2

Hi,

Need some help gathering thoughts on this issue.

Our team is moving ahead with the idea that separating the authenticated and public sections of our app in two separate folders will allow us to be more organized and secured. I have seen this approach for Admin apps within the site but never for authentication.

We are currently using Authlogic.

What would be the disadvantage of this?

Thanks for your help.

A: 

i don't think you will find any disadvantages with moving the controllers into subfolders. we actually do this by "namespace"/process. for example, we have an "order" subfolder containing all controllers related to an order.

i think having a clean folder structure inside your rails app directory increases maintainability.

rubiii
Hi rubii,Good to know that this is done by other companies.Thanks!
EngW3
subfolders seem to be ok, but don't namespace controllers. you will get yourself into various problems. starting with caching.
rubiii
A: 

We namespace controllers in this manner - typically we'll have a /admin and a /my folder for the admin and user account controllers respectively.

Additionally, in the subfolder we will have an application_controller.rb that each of the controllers in that subfolder derives from. So in the admin subfolder, we have an application_controller.rb that looks like this:

class Admin::AdminController < ApplicationController
  permit "admin"
  layout 'admin'
end

We'll then inherit from this controller in our admin controllers. The example uses the rails-authorization-plugin for roles.

Mr. Matt