you should be able to solve this using a proxy in DBIx::Class. see the
pod for DBIx::Class::Relationship::Base (search for 'proxy').
disclaimer: I use this technique for 'belongs_to' relationships myself,
and it work's fine there. 'might_have' is a one-to-one relationship, so
I'd expect it to work there in the same way, but I haven't tested it.
> ########################################
> package MyApp::Schema::DB::Result::Incident;
> #...
> __PACKAGE__->table("incident");
> __PACKAGE__->add_columns(
> "id",
> { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
> #...
> );
> __PACKAGE__->set_primary_key("id");
> __PACKAGE__->*might_have*( incident_info =>
> 'MyApp::Schema::DB::Result::IncidentInfo' );
add a proxy attribte to the incident_info relation:
{ proxy => [ qw(info other_field_in_incident_info) ] }
> ########################################
> package MyApp::Form::Incident;
> use HTML::FormHandler::Moose;
> extends 'HTML::FormHandler::Model::DBIC';
> with 'RenderFields';
> use DateTime;
>
> has '+item_class' => ( default => 'Incident' );
> has_field 'id' => ( type => 'Hidden', );
> #...
> has_field '*
incident_info.info*' => ( type => 'TextArea', cols
> => 50, label => 'Info',
> title => 'Commentary, Information and Background Notes', );
here, you treat the proxied fields as if thery were in the incident
table itself:
has_field 'info' => (...);
> Then in the template, something like...?
> [% form.render_field('
incident_info.info') %]
same here:
[% form.render_field('info') %]
HTH
patrick
--
Patrick Meidl ........................
+43 1 9688226 (home)
Pazmanitengasse 4/10 .................
+43 680 2072780 (mobile)
1020 Wien ............................
pat...@pantheon.at
Austria ..............................
http://pmeidl.homelinux.net/
--