On Mon, May 30, 2011 at 3:26 PM, Mickiii <michael.la...@gmail.com> wrote:

> I am fairly new to rails, and have been through a few books, and am
> now starting to sketch out an application, however I have run into a
> problem with regards to the structure of the app.
>
> I want to build an application that is setup in modules, and examples
> of urls could be:
>
> /Sales <- frontpage for sales
> /Sales/Customers <- customer index
> /Sales/Customer/123 <- Customer 123
> /Sales/Invoices <- sales invoice index
> /Sales/Invoice/123 <- show invoice 123
> /Sales/Invoice/123/Post <- post action for the invoice
> /Purchase <- frontpage for purchases
> /Purchase/Vendors <- vendor index
> /Settings/Currencies <- currency index
> etc...
>
> So in short, I would like to build the app with modules of sales,
> purchase, inventory etc. What is the best way of setting this up? Do I
> make a controller for each module, i.e. sales_controller,
> purchase_controller or should I use namespaces and routes for this or
> is there a better way?
>
> Any help and best practices on this is very much appreciated.
>

I have seen a few questions similar recently, here's an opinion, and what is
my 'best practice' when faced with design questions. I would recommend that
rather than try to figure out the right structure beforehand, that you build
your app incrementally (and in a test driven manner for sure) and contend
that through that process you will derive the right structure.

I.e. you know you need to have users so build up a user model and controller
and implement authentication. Then go to what the user would do next in the
app. Yes, you will change and have to redo things as you go but in reality I
would put money that you end up with a prettier design that grew
organically. This does mean that you have discipline and when you see an
issue --- whether in structure or even just how you have named something
that you dont overlook it and make necessary changes as you go.

Just a thought... this aproach has worked well for me, much better than
planning ahead, believe it or not.


> Thanks in advance
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to