# Best practise structure for large project

**URL:** <https://www.ruby-forum.com/t/best-practise-structure-for-large-project/141430>\
**Category:** Rails\
**Created:** [June 25, 2008, 8:27pm UTC](https://www.ruby-forum.com/t/best-practise-structure-for-large-project/141430 "2008-06-25T20:27:18Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![sigma](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/dec6dc/32.png) [@sigma](https://www.ruby-forum.com/u/sigma)\
**Post date:** [June 25, 2008, 8:27pm UTC](https://www.ruby-forum.com/t/best-practise-structure-for-large-project/141430/1 "2008-06-25T20:27:18Z")

</div>

Hi all

Is there anywhere a good tutorial for a “best-practise” structure  
(controller,…) for a large project?

I did’t find one by now…

thank you for your help!

Greets

sigma

---

<div class="post-metadata">

**Author:** ![sigma](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/dec6dc/32.png) [@sigma](https://www.ruby-forum.com/u/sigma)\
**Post date:** [June 25, 2008, 11:49pm UTC](https://www.ruby-forum.com/t/best-practise-structure-for-large-project/141430/2 "2008-06-25T23:49:37Z")

</div>

Structure of what? Your models, views and controllers?

And by best practice, what is wrong then the standard layout given to  
you by rails?

---

<div class="post-metadata">

**Author:** ![sigma](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/dec6dc/32.png) [@sigma](https://www.ruby-forum.com/u/sigma)\
**Post date:** [June 26, 2008, 5:53am UTC](https://www.ruby-forum.com/t/best-practise-structure-for-large-project/141430/3 "2008-06-26T05:53:38Z")

</div>

Hi

By structure i mean the structure of controllers.  
What is the standardway for large projects? All controllers in the  
same directory? Or is grouping them by functionality in sub  
directories a better solution?

And another question:  
Is it possible to do something like: localhost:3000/projects/1/tasks/5  
-\> to get project with id 1 and than the task with id 5 from this  
project (just as an example)

Greets

---

<div class="post-metadata">

**Author:** ![sigma](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/dec6dc/32.png) [@sigma](https://www.ruby-forum.com/u/sigma)\
**Post date:** [June 26, 2008, 4:15pm UTC](https://www.ruby-forum.com/t/best-practise-structure-for-large-project/141430/4 "2008-06-26T16:15:55Z")

</div>

I would recommend just jumping in with some tutorials and taking a  
look at what Rails offers.

---

<div class="post-metadata">

**Author:** ![sigma](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/dec6dc/32.png) [@sigma](https://www.ruby-forum.com/u/sigma)\
**Post date:** [June 26, 2008, 4:22pm UTC](https://www.ruby-forum.com/t/best-practise-structure-for-large-project/141430/5 "2008-06-26T16:22:58Z")

</div>

On Wed, Jun 25, 2008 at 11:53 PM, sigma [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> And another question:  
> Is it possible to do something like: localhost:3000/projects/1/tasks/5  
> → to get project with id 1 and than the task with id 5 from this  
> project (just as an example)

Go read  
[Rolling with Rails 2.0 - The First Full Tutorial - Part 1 | AkitaOnRails.com](http://www.akitaonrails.com/2007/12/12/rolling-with-rails-2-0-the-first-full-tutorial),  
which walks you through exactly how to do this.

–wpd

---

<div class="post-metadata">

**Author:** ![sigma](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/dec6dc/32.png) [@sigma](https://www.ruby-forum.com/u/sigma)\
**Post date:** [June 26, 2008, 4:35pm UTC](https://www.ruby-forum.com/t/best-practise-structure-for-large-project/141430/6 "2008-06-26T16:35:17Z")

</div>

Thank you!  
I’ll try it out

sigma

---

<div class="post-metadata">

**Author:** ![sigma](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/dec6dc/32.png) [@sigma](https://www.ruby-forum.com/u/sigma)\
**Post date:** [June 26, 2008, 6:10pm UTC](https://www.ruby-forum.com/t/best-practise-structure-for-large-project/141430/7 "2008-06-26T18:10:31Z")

</div>

To be honest, i have sort of the same question sometimes.

What i tend to do is separate my controllers into sections. so for  
example, i have an admin section, a public section (in folders named  
admin and public\_section since public kind of messes up autotest  
mappings… but thats another story) and other sections.

Then have my controller files in there and in my views, i have a  
folder structure mirroring that.

Then the fun beggins:

For each one of this sections you need to map the route for it so in  
routes:

map.namespace :section\_name do |section\_name|  
section\_name.resources :model\_name  
section\_name.connect …  
section\_name.whatever  
end

There are a few inconveniences with this approach which i will let you  
discover by yourself since i ran out of time.

j
