On Tue, May 22, 2007 at 04:36:06PM -0700, mla wrote:
> 
> The PKs seem arbitrary in this case. I don't know if they
> should be referenced at all. I'd tend to use a subselect...
> 
>   UPDATE carts SET cart_status_id = (
>     SELECT id FROM cart_status WHERE name = 'Completed'
>   );
> 
> But in a more ORM way, maybe something like
> 
>   my $status = Cart::Status->fetch(name => 'Pending');

Ya, but "Pending" is the description of the status, not the actual
abstract status.

    Your cart is: [% cart.cart_status.name | html %]

Manager makes decision:

    update cart_status set name = 'Not Completed' where name = 'Pending';

This still works:

    Your cart is: [% cart.cart_status.name | html %]


But everywhere you did this is now broken:

  my $status = Cart::Status->fetch(name => 'Pending');



But if I did this everywhere instead:

  my $status = Cart::Status->fetch(name => cart_pending_status );

I'd still be on the beach.


But the question was how do I represent constants best?



-- 
Bill Moseley
[EMAIL PROTECTED]


_______________________________________________
List: [email protected]
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to