Kind of a lame hack because set_inflated_columns isn't quite working as i think
it's supposed to. Giving control over creating the new, unstored, result from
object_no_id to the creation thingy would probably fix this properly.
sub insert_object_from_params
{
my ($self, $c, $object, $params) = @_;
- $object->set_columns($params);
+
+ my %rels;
+ while (my ($k, $v) = each %{ $params }) {
+ if (ref $v && !($v == JSON::Any::true || $v == JSON::Any::false)) {
+ $rels{$k} = $v;
+ }
+ else {
+ $object->set_column($k => $v);
+ }
+ }
+
$object->insert;
+
+ while (my ($k, $v) = each %rels) {
+ $object->create_related($k, $v);
+ }
}
=method_protected delete_objects