small medium large xlarge

26 Mar 2008, 09:38
Alexandru Ungur (1 post)

First of all, thank you for a great book. I found it very useful.

On the multi-models forms recipe, there’s one little gotcha: all goes well and smooth until you get to the save part. There, things may go smooth if all your data in child rows is valid. Or you can even get nice validation errors if you use validates_associated. However if the save of child rows fails for whatever reasons (say, because of using callbacks, that properly return false hoping to break the save chain) you run out of luck. No child rows being saved and no errors whatsoever so that you can have a clue what’s going on. In other words, to quote from AWDwR:

“Finally, there’s a danger here. If the child row cannot be saved (for example, because it fails validation), Active Record will not complain - you’ll get no indication that the row was not added to the database.”

Perhaps it would be a good idea to remind the users of this recipe of that danger, might spare them of a few headaches :-)

Have a great day

11 Jun 2008, 20:24
Kurt Wiedenhoeft (1 post)

I am also enjoying this book. I have had good luck with this recipe, but I’m running into a problem when I try to add a date or date/time select box to the “tasks” section. I have the code working great, but as soon as I add this to my partial, it breaks:

<%= task_form.date_select :pickup_at %>

When I add a new task and submit the form, I get a 500 error, and the following message in the log:

“Conflicting types for parameter containers. Expected an instance of Array but found an instance of Hash. This can be caused by colliding Array and Hash parameters like qs[]=value&qs[key]=value.”

If I manually add the related record to the table, it will render the date select properly and I can submit changes without error. However, any new tasks I add will cause the submit to fail. This looks very much like the problem mentioned here:

I applied the patch supplied, but it didn’t make a difference. Has anyone else run into this, and maybe found a solution?



09 Oct 2008, 03:32
stefan Penner (1 post)

Hey Kurt, I also encountered this issue. I realize this post is quite old but here is my solution to the datetime_select issue:

Hopefully this can help some people


29 Oct 2008, 13:20
Hiro SHINOHARA (1 post)


Thanks so much. The article you posted here was completely helpful!

– Hiro

14 Mar 2009, 10:09
Hemant Khemani (1 post)


As already mentioned by Kurt date_select and time_select has issues with multi-model form when a new record is being saved.You can find the cause of the problem and the workaround in this blog post


You must be logged in to comment