Topic: A beginner's question about directory structure

This isn't exactly an advanced design/theory question, so I'm not sure if it should have gone in general. If so, I apologize.

I'm new to Rails, just starting in fact, and I've already gobbled up all the literature I can find for free. Now I'm on my way to actually building an application, and I've hit a bit of a design snag.

Let's say I have a system for submitting requests, and on the request page a user can choose from two drop down menus - one called categories, one called departments. As per the structure of rails, I've now got category/ and department/, along with request/. So then, if I wanted to make an administrative aspect of the website, which would only allow logged-in, authenticated users to view category/ and department/, how would that be done?

I come from PHP, and under PHP it would be simple - I simply have an admin/ folder with the necessary PHP files there. Glancing at the app/ folder, I see that it is not quite the same. I can't just wrap up all the MVC components I want, toss them in a folder, and move them, as far as I can tell.

Just to clarify: I don't need help authenticating, or anything like that. I need help in understanding how to use Rails to make a cohesive directory structure, ie:
instead of

Thanks in advance.

Re: A beginner's question about directory structure

all the controllers you make sit outside of the public directory so you can arrange them however you feel comforatable. if you want to restric access this generally involves a user model and a before filter in the controllers you want to restrict access to. you can use a plugin (search for rick olsons plugins, he has a couple of authentication ones), also if you get rails recipes book by chad fowler he has a good user solution in there.

if you add directories to your controller it will change the way your url is displayed by default
so if you have app/controllers/admin_folder/admin_controller your url will look like

you can specify folders on the command line when generateing controllers "script/generate controller admin_folder/admin_controller admin_actions

but can change the way the url's look with out changing your directory structure. checkout ryans screencast on it here

Last edited by BasicMind (2007-05-31 09:03:16)


Re: A beginner's question about directory structure

i need to develop ip management i had designed three tables 1) IP 2) employeeName 3) ListOfDetails

ListOfDetails contains forieng key for ip and employeeName
how to wirht the relation in controller to display in view