Is there a reason why @workitem.fields_hash['params'] could ever be nil in ruote-web? I assume not, but if so, then WorkitemHelper:: find_partial needs a minor patch.
Why do I ask?
While experimenting with some custom forms I forgot to add hidden fields to preserve the workflow parameters. This basically resulted in the field 'params' to be removed (as many other fields), which is a problem in WorkitemHelper:: find_partial which uses
128: activity = wi_fields['params']['activity']
Of course, one can easily add "if wi_fields['params']" or whatever, but on the other hand: the unexpected nil saved me from a lot of trouble at a later moment... :-)
> Is there a reason why @workitem.fields_hash['params'] could ever be nil in > ruote-web? I assume not, but if so, then WorkitemHelper:: find_partial needs > a minor patch.
> 128: activity = wi_fields['params']['activity']
What about something like
---8<--- class OpenWFE::Extras::Workitem def params self.field('params') || {} end end --->8---
?
It's true that having it break and complain can save time. (Hence not sure about adding).
So I assume that 'params' should indeed never be nil?
Apart from having a default or not: a method "params" might be nice indeed, although then one might not expect "fields" to return those params as well -- so maybe adding it would be confusing...
> This #Lxxx trick is neat, where did you learn about it ?
Errr, I just clicked on the line number in the normal view, and there it was :-)
> So I assume that 'params' should indeed never be nil?
Well, let's say that ruote-web, out of the box, assumes it will never be nil. Please "monkey patch" Workitem (and the rest) at will in your application. If the need becomes a pain, why not add the patch to the core class, later.
> > This #Lxxx trick is neat, where did you learn about it ?
> Errr, I just clicked on the line number in the normal view, and there it > was :-)
Priceless, though I couldn't get it to do ranges :-(