[html-formfu] multiple model_stash?
Carl Franks
fireartist at gmail.com
Fri Mar 20 14:37:43 GMT 2009
2009/3/20 Josef Chladek <josef.chladek at gmail.com>:
> hello list,
>
> in my config in catalyst I have
>
> __PACKAGE__->config(
> 'Controller::HTML::FormFu' => {
> model_stash => {
> schema => 'Frontwave',
> },
> },
>
> now I want to use a different model in a different (formfu)-controller. how
> would I set the model_stash for that controller directly or is there a
> config option to specify which model_stash to use in which form?
There are only 2 places the schema is used by Model-DBIC:
options_from_model()
and create()
In options_from_model(), if there's no schema, it'll search for
$context->model( $form->model_config->{model} )
So that would handle multiple models, as long as you don't have a
$form->stash->{schema} set.
It would probably make sense to update create() to do the same
fallback, if {schema} isn't found.
Carl
More information about the HTML-FormFu
mailing list