[Catalyst] CatalystX::CRUD Storage Error
Peter Karman
peter at peknet.com
Tue Jul 28 13:30:44 GMT 2009
Peter Karman wrote on 07/28/2009 07:51 AM:
> Amiri Barksdale wrote on 7/27/09 8:46 PM:
>> On Thu, Jul 16, 2009 at 11:33:38PM -0500, Peter Karman wrote:
>> | Also, your controller inherits from the base CatalystX::CRUD::Controller, which
>> | doesn't really *do* anything by default. I.e., you need a form handler to
>> | serialize and validate your model. Look at CatalystX::CRUD::Controller::RHTMLO
>> | for one example. Or consider writing a controller base class that adapts your
>> | favorite form handler (HTML::FormFu or Form::Processor or ...).
>>
>> I am making quite a bit of headway with this, and I have chosen
>> HTML::FormHandler as...my form handler.
>>
>> I am having some difficulty integrating the two, though. A controller
>> and a form that it uses look like this:
>>
>> http://scsys.co.uk:8001/31717
>>
>> When I start the server and try to look at ui/crud/creator/list, I get
>> this error:
>>
>> Caught exception in ml2::Controller::UI::CRUD::Creator->auto "Attribute
>> (form) does not pass the type constraint because: Validation failed for
>> 'ml2::Forms::CreatorForm' failed with value ml2=HASH(0xd27cf30) (not isa
>> ml2::Forms::CreatorForm) at
>> /home/amiri/mlrepo/lib/perl5/CatalystX/CRUD/Controller.pm line 110
>>
>> Instead of C::X::CRUD loading the form, it is loading the whole
>> application class.
>>
>> Is my controller still misconfigured?
>
> no, it's a bug in the documentation. The default form() method looks like this:
>
> sub form {
> my ( $self, $c ) = @_;
> # ...
> }
>
> and so your override needs to expect $c as well.
>
I should clarify further. Your controller code:
has 'form' => (
isa => 'ml2::Forms::CreatorForm',
is => 'rw',
default => sub { ml2::Forms::CreatorForm->new },
);
is moreorless what the base controller does. So by having that 'has'
declaration, you break it. Try taking the 'has' declaration out and see
if that works.
--
Peter Karman . http://peknet.com/ . peter at peknet.com
gpg key: 37D2 DAA6 3A13 D415 4295 3A69 448F E556 374A 34D9
More information about the Catalyst
mailing list