[Catalyst] OT: edit/add seperate actions?

J. Shirley jshirley at gmail.com
Tue Mar 3 15:46:52 GMT 2009


On Tue, Mar 3, 2009 at 7:33 AM, Iain <iainhubbard at googlemail.com> wrote:

> Hello all,
>
> So we are having a discussion @work about basic add/edit functions. We
> currently have currently two lines of thoughts on handling it.
>
> 1. Have separate actions for adding and editing e.g.
>
> # add
> /app/notice/add_new (POST To) /app/notice/process_add_new
>
> # edit
> /app/notice/*/edit (POST To) /app/notice/*/process_edit
>
> 2. Have a shared edit action with an if ( $c->req->method eq 'POST' )
> check.
>
> # edit
> /app/notice/*/edit (POST Back to) /app/notice/*/edit
>
> There currently doesn't look like much difference in lines of code to
> manage.
>
> Just wondering if anybody has any thoughts/experience, pros/cons best
> practice etc of either approach.
>
> Actually, I like option 2 best. So I suppose I'm asking for reasons why
> we shouldn't use option 1 :-)
>
> Iain.
>
>
>
The main difference in all of this is the forms displayed to the user.  I'm
a big advocate and fan of REST, but I understand that it often times doesn't
fit in seamlessly.

I'm also a big fan of Catalyst::Controller::DBIC::API which has both REST
and CRUD assists, using Chained.  It works quite well for most applications
and takes a lot of the yakshaving and hides it in a base class.

If you take a look there, you'll see the difference between the RESTful
approach and the CRUD approach.  It sounds like for your uses, you'll like
the CRUD approach better.

-J
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20090303/8f27f=
5e5/attachment.htm


More information about the Catalyst mailing list