# Rails 2.3.5 error\_messages\_for with object array

**URL:** <https://www.ruby-forum.com/t/rails-2-3-5-error-messages-for-with-object-array/180300>\
**Category:** Rails\
**Created:** [December 16, 2009, 11:07pm UTC](https://www.ruby-forum.com/t/rails-2-3-5-error-messages-for-with-object-array/180300 "2009-12-16T23:07:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bill](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ac91a4/32.png) [@bill](https://www.ruby-forum.com/u/bill)\
**Post date:** [December 16, 2009, 11:07pm UTC](https://www.ruby-forum.com/t/rails-2-3-5-error-messages-for-with-object-array/180300/1 "2009-12-16T23:07:20Z")

</div>

Though I understand there was a problem with nested attributes and  
error\_messages\_for in Rails 2.3.4, this works fine for me, even if one  
of the objects is missing:

```
error_messages_for(:object=>[@order, @order.items, @order.payments])

```

In Rails 2.3.5, this throws an exception if any of the objects are  
missing, which is the typical case in my app.

ActionView::TemplateError (undefined method `errors’ for  
#Class:0xb6fbbda8) on line #4 of app/views/order/test.html.erb:  
1:  
2: \<%= error\_messages\_for(:object=\>[@order, @order.items,  
@order.payments],  
3: :header\_message =\> “Sorry…”,  
4: :message=\> “The following errors occurred with  
your cart/order:”) if @order  
5: %\>
