[Dbix-class] create failures with has_one

Wallace Reis wallace at reis.org.br
Thu Oct 15 13:47:13 GMT 2009


On 15/10/2009, at 08:34, Dermot wrote:

> 2009/10/15 Wallace Reis <wallace at reis.org.br>:
>> On 14/10/2009, at 13:10, Dermot wrote:
>>>
>>> my $record = {
>>>         'validation_pass' => 1,
>>>         'files' => [],
>>>         'active' => 1,
>>>         'name' => 'Gustav MR',
>>>         'clipdata' => [
>>>                         {
>>>                           'contrib_id' => 2,
>>>                         }
>>>                       ],
>>>         'contrib_id' => 2,
>>>       };
>>>
>>
>> Use a HashRef for clipdata rel instead of a ArrayRef.
>
> Thanx for the replay.
>
> Under ~/Class/ResultSet.pm#create it says use a Arrayref for has_one
>
> "Example of creating a new row and also creating rows in a related
> has_many or has_one resultset. Note Arrayref."

Patches are welcome!

> I think my problem was using update_or_create(). I think there are
> differences between the what create() and what update_or_create()
> expects. This might explain the Recursive update error I got as well.
>
> At the moment I am using find_or_create() and that is working as  
> expected.


There is no difference between those APIs, both update_or_create and  
find_or_create use ->create.

--
    wallace reis/wreis         Catalyst and DBIx::Class consultancy  
with a clue
    Software Engineer          and a commit bit: http://shadowcat.co.uk/catalyst/
Shadowcat Systems Limited
http://www.shadowcat.co.uk     http://www.linkedin.com/in/wallacereis



More information about the DBIx-Class mailing list