# Committing a record update to the DB from a test

**URL:** <https://www.ruby-forum.com/t/committing-a-record-update-to-the-db-from-a-test/132685>\
**Category:** Rails\
**Created:** [March 23, 2008, 2:22pm UTC](https://www.ruby-forum.com/t/committing-a-record-update-to-the-db-from-a-test/132685 "2008-03-23T14:22:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![RaniOnRails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/bbce88/32.png) [@RaniOnRails](https://www.ruby-forum.com/u/RaniOnRails)\
**Post date:** [March 23, 2008, 2:22pm UTC](https://www.ruby-forum.com/t/committing-a-record-update-to-the-db-from-a-test/132685/1 "2008-03-23T14:22:15Z")

</div>

Hi all, I hope someone can help me with this.

I’m trying to write a test to see if my versioning (acts\_as\_versioned)  
works. In order to do that, I have a class which inherits from  
ActiveRecord:  
class Order \< ActiveRecord::Base

However, when I try to update or to create a new order within the  
test, my changes do not affect the DB:  
o = Order.create(:name =\> ‘n’, :email =\> ‘e’, :address =\>  
‘a’, :pay\_type =\> ‘po’)  
o.save  
o.name = ‘m’  
o.save  
order = Order.find(@first\_id)  
#order.pay\_type = ‘po’; order.address = ‘dummy address’;  
order.email = ‘d@d.d’; order.name = ‘first ammended’  
order.update\_attributes({ :pay\_type =\> ‘po’, :address =\> ‘123 hh  
road’, :email =\> ‘r@r.r’, :name =\> ‘2nd ammended’})

I run this, and nothing is committed to the DB! Can anyone help?

Thanks
