On Wed, 25 Aug 2010, Pavel A. Karoukin wrote:

> use JSON::XS;
> use Hash::AsObject;
>
> __PACKAGE__->inflate_column(
>     'data',
>     {
>       inflate => sub {
>         Hash::AsObject->new(decode_json( shift() ))
>       },
>       deflate => sub {
>         encode_json shift
>       },
>     },
> );
>
>
> It works well for retrieving values from DB:
> $test = $user->data->{test}; # return 1
>
> But to save data in db I want to do following:
> $user->data->{test} = 1;
> $user->update();
>
> This doesn't work. It successfully assign 1 to $user->data->{test}, but it 
> never passes to
> deflator and never stores in the DB.

$user->test(1);
$user->update();
# ???

Mark
_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[email protected]

Reply via email to