[html-formfu] Creating options in many_to_many_select

Carl Franks fireartist at gmail.com
Sun Dec 16 10:25:19 GMT 2007


On 16/12/2007, Zbigniew Lukasiak <zzbbyy at gmail.com> wrote:
> Thanks for the explanation.  Is it possible to decouple it from
> Catalyst by putting the schema on the stash?
> I know FormFu is mostly used with Catalyst - but you never know and
> beside that it would simplify testing.

Yes, I initially thought it not too dependant on Catalyst - you just
need an object in $form->stash->{catalyst} that supports a model()
method - but it makes sense to not have to bother with that.

How about:
* if db: { model: x } is set, do $db = stash->{catalyst}->model(
args->{db}{model} )
* else do $db = stash->{ args->{db}{stash} }

* and if db: { schema: x } is set, do $db = $db->resultset( args->{db}{schema} )

This lets you put either your model or table schema on the stash.

Carl



More information about the HTML-FormFu mailing list