Committing a record update to the DB from a test

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
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’) = ‘m’
order = Order.find(@first_id)
#order.pay_type = ‘po’; order.address = ‘dummy address’; = ‘[email protected]’; = ‘first ammended’
order.update_attributes({ :pay_type => ‘po’, :address => ‘123 hh
road’, :email => ‘[email protected]’, :name => ‘2nd ammended’})

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


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs