I frequently find when making webapps that I may have a complex web
form which submits many fields intended to be stored across several
tables. I would prefer to just translate all those parameters into a
single hash, and pass that hash to DBIx for creating/updating records.
ie; If I transfer all submitted form parameters into a hash called
%Data, I would then like to simply go:
$c->model('DB::OneTable')->create(\%Data);
(This is a Catalyst app...)
The problem here is that methods like create expect all key/value
pairs passed in to match column names, so any extra fields cause it to
fail with a "No such column" error.
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?
Currently I am having to specify columns manually, and I need my
Catalyst Controllers to handle data without caring what the full
column list is.
--
Trevor Phillips - http://dortamur.livejournal.com/
"On nights such as this, evil deeds are done. And good deeds, of
course. But mostly evil, on the whole."
-- (Terry Pratchett, Wyrd Sisters)
_______________________________________________
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]