# Update multiple rows -- detect failure how?

**URL:** <https://www.ruby-forum.com/t/update-multiple-rows-detect-failure-how/138566>\
**Category:** Rails\
**Created:** [May 24, 2008, 9:07pm UTC](https://www.ruby-forum.com/t/update-multiple-rows-detect-failure-how/138566 "2008-05-24T21:07:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![djlewis](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/7bcc69/32.png) [@djlewis](https://www.ruby-forum.com/u/djlewis)\
**Post date:** [May 24, 2008, 9:07pm UTC](https://www.ruby-forum.com/t/update-multiple-rows-detect-failure-how/138566/1 "2008-05-24T21:07:28Z")

</div>

I want to update multiple rows using ActiveRecord#update, especially  
because params for the table contains just the right data structure  
for the update method (an array of attribute/value hashes, one per  
record). But the Rails docs say about this method “… the resulting  
object is returned whether the object was saved successfully to the  
database or not.”

So how does one test if the update failed?

Thanks. --David.

---

<div class="post-metadata">

**Author:** ![djlewis](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/7bcc69/32.png) [@djlewis](https://www.ruby-forum.com/u/djlewis)\
**Post date:** [May 24, 2008, 10:31pm UTC](https://www.ruby-forum.com/t/update-multiple-rows-detect-failure-how/138566/2 "2008-05-24T22:31:28Z")

</div>

> So how does one test if the update failed?

Inspect the model.errors array?
