[Catalyst] Epiphany Sunday: chained action vs namespaces

apv apv at sedition.com
Mon Nov 27 01:06:41 GMT 2006


I just thought I'd share an epiphany in case any other lunkheads were  
under the same misconception I was.

I had been avoiding chained actions for months b/c I was under the  
impression they were synonymous with code namespaces. Today, I  
realized they aren't.

So, I was doing things like:
  /post/[id]
  /admin/post/[id]

With plenty of duplicated code between them because I thought the  
admin paths had to be under Admin::auto to do blanket security stuff  
and I didn't want to seed security checks everywhere b/c I know I'd  
miss something.

I realize now I can do
  /post/[id]
  /post/[id]/edit
  /post/[id]/private_notes # whatever

And put the edit code into Admin::Post::edit and just chain it back  
to the public Post view.

Like built-in information architecture. Thanks again to all the Cat  
developers. SO NICE.


–Ashley
-- 





More information about the Catalyst mailing list