On Wednesday, April 25, 2012 1:34:49 PM UTC-7, GShank wrote:
That message is coming from RecursiveUpdate. The addition of that key to
params is not relevant, that I can see. Probably you're doing something
wrong in your "around 'update_model'".
Are you doing $self->$orig(@_)? Show the code?
I've included the around update_model below, but if I comment the entire method out and just run a regular update out I still hit that error. You'll see where I've now added delete($self->params->{file}) because that allowed me to get past the error! Without that, if I include a file in the form submission it breaks!
Thanks for taking a look!
117 around 'update_model' => sub {
118 my $orig = shift;
119 my $self = shift;
120 my $item = $self->item;
121
122 # ***HACK***
123 # file uploads seem to break DBIx::Class::ResultSet::RecursiveUpdate here,
124 # and we save them elsewhere anyway, so now that we've validated we delete
125 # the file param entry...
126 delete($self->params->{file});
127
128 $self->schema->txn_do( sub {
129
130 # run the dbic model updates for node table
131 $self->$orig(@_);
132
133 # get the access permission fields and update node_access accordingly
134 if ($self->user_roles_ids) {
135 foreach my $role_id ( @{ $self->user_roles_ids } ) {
136 my $view = $self->field("view-".$role_id)->value || 0;
137 my $edit = $self->field("edit-".$role_id)->value || 0;
138
139 $self->schema->resultset('NodeAccess')->update_or_create({
140 node_id => $item->id,
141 role_id => $role_id,
142 view => $view,
143 edit => $edit,
144 });
145 }
146 }
147
148 # update the menu value
149 if ( $self->field('name') && $self->field('name')->value ) {
150 my $menu_item = $self->schema->resultset('Menu')->search({
151 node_id => $item->id
152 })->first;
153
154 if ($menu_item) {
155 if ($self->field('delete_menu_item')->value) {
156 $menu_item->delete;
157 }
158 else {
159 $menu_item->update({
160 name => $self->field('name')->value,
161 description => $self->field('description')->value,
162 path => 'node/'.$item->id,
163 parent_id => $self->field('parent_id')->value,
164 node_id => $item->id,
165 });
166 }
167 }
168 else {
169 $self->schema->resultset('Menu')->create({
170 name => $self->field('name')->value,
171 description => $self->field('description')->value,
172 path => 'node/'.$item->id,
173 parent_id => $self->field('parent_id')->value,
174 node_id => $item->id,
175 }) if !$self->field('delete_menu_item')->value;
176 }
177 }
178
179 });
180 };