Well, I spent an hour or more today tracking down an apparently 
undocumented behaviour in Hobo.


It turns out that for a new record the Rapid <form> tag inserts hidden 
fields for any attribute which is not nil, i.e. which has been initialized. 
I could not find this mentioned in the documentation for the <form> tag nor 
in the Hobo manual (not to say it isn’t there somewhere).


This insertion of hidden fields caused an obscure bug when one of the 
inserted fields was for a serialized attribute with a class of Hash. Rails 
initializes the attribute to an empty hash for a new record. Hobo inserts a 
hidden field for this attribute in the form — which of course is rendered 
as a string. When the form is submitted, the attribute is given this string 
value (from the params hash) and an ActiveRecord::SerializationTypeMismatch 
error is raised.


It took some sleuthing inside the Rapid form_helper method to find out what 
was happening and to discover that the <form> tag takes a hidden_fields 
attribute and that if you set this attribute empty then these hidden fields 
are not generated. This attribute of the <form> tag is not documented.


Hobo giveth and Hobo taketh away.

-- 
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to hobousers+unsubscr...@googlegroups.com.
To post to this group, send email to hobousers@googlegroups.com.
Visit this group at http://groups.google.com/group/hobousers.
For more options, visit https://groups.google.com/d/optout.

Reply via email to