I’m trying to save multiple records of the same model in one go. Which
is no problem at all. Problem starts when I want to introduce error
handling. The problem is that no record should be saved when one of the
records contains an error. I tried it as follows:
session[:infos].each do |info|
@quest.name = info[“name”]
@errors_found = true
render :action => ‘new’
So if an error has occurred I prevent all the records from being saved.
The only problem I’m having is that I can only show errors from the last
record that contained an error. So if one or more of the other records
has an error, I can’t show them to the user. Is their a way to
‘preserve’ the errors added with errors.add in the model, so I can
display the errors for all the records. All suggestions are welcome.