On Mar 12, 2009, at 10:22 PM, Trevor Phillips wrote:

Is there an easy and efficient way to either tell methods like create
to ignore extra columns passed in, or to filter %Data to only include
columns in the table?

I don't know about efficient, but this is how I do it...

package MyApp::DB::Result;
use parent 'DBIx::Class';
# ...
sub absorb {
    my ( $self, $in ) = @_;

    $self->update( {
        map { ( $_ => $in->{ $_ } ) }
        grep { $self->has_column( $_ ) }
        keys %{ $in }
    } );
}

--
Jason Kohles, RHCA RHCDS RHCE
[email protected] - http://www.jasonkohles.com/
"A witty saying proves nothing."  -- Voltaire



_______________________________________________
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