On Tue, Nov 4, 2008 at 10:47 AM, monk.e.boy <[EMAIL PROTECTED]> wrote:
>
>
>
> Matthew Weier O'Phinney-3 wrote:
>>
>> -- Matthew Ratzloff <[EMAIL PROTECTED]> wrote
>>
>> I'm going to have to agree here. The rule of thumb I use -- based back
>> on my CGI::Application days -- is that an action/page controller should
>> only have around 7 actions, maximum; more than that, and it should be
>> broken apart into more discrete controllers. The rationale is that the
>> more actions you add, the less likely that they are all related, and you
>> can likely create sub-groups of actions.
>>
>
>
> Seven?! I have a DB with tons of data, this part of the site shows the
> reports. There are hundreds of different reports.
>
>
>
> Matthew Weier O'Phinney-3 wrote:
>>
>> Additionally, as someone else noted, if you have 3000 lines, chances are
>> that you're probably doing a lot of business logic in your controller -
>> and you should move that logic into model classes.
>> --
>> Matthew Weier O'Phinney
>> Software Architect       | [EMAIL PROTECTED]
>> Zend Framework           | http://framework.zend.com/
>>
>>
>
>
> Each action is only a few lines long.
> At the moment my URLs look like ths:
>
> http://site.com/reports/report-1/
> http://site.com/reports/report-2/
>
> obviously my reports have nice names. Some reports are kinda related so I
> could possibly group them:
>
> http://site.com/reports/about-people/tall-people/
> http://site.com/reports/about-people/people-with-long-hair/
>
> http://site.com/reports/about-buildings/report-3/
> http://site.com/reports/about-buildings/with-illegal-doors/
> http://site.com/reports/about-buildings/with-boilers/
> http://site.com/reports/about-buildings/with-no-windows/
>
> http://site.com/reports/other/buildings-owned-by-x-with-people-from-company-z/
>
> ...they don't really fall into nice groups like this. Also I guess my URLs
> wouldn't be able to have that nice tree structure? Any advice? How do I get
> down to seven actions?! hlpz plz!!

You could make a report module and group the reports into different controllers.

Or you refactor the "few lines" in each action into a model and use
/reports/show/FOO (ReportsController::showAction()) where FOO is an ID
or string to lookup which report to build. Which leaves you with one
action. ;-)

Till

Reply via email to