Ruby activerecord problem


#1

Hello friends,
I have written a ruby code which generates table in the database. I have
given an option of overwriting the table if it already exists. Here is
the code

domain_object_class “AuditTrailEntry” do
attribute “process_code”, :of_type => :string
attribute “process_instance_id”, :of_type => :integer
attribute “workflow_model_element”, :of_type => :string
attribute “event_type”, :of_type => :string
attribute “timestamp”, :of_type => :datetime
attribute “originator”, :of_type => :string
attribute “data”, :of_type => :binary, :optional
=> true

overwrite true
end

session = Session.new()

trail_entry = AuditTrailEntry.create(:session => session,
:process_code => “007”,
:process_instance_id => 42,
:workflow_model_element =>
“element1”,
:event_type => “on_delete”,
:timestamp => Time.now(),
:originator => “orig”)
session.persistChanges()
session.end()
puts(“Done!”)

same is for work_list_items table.

when I run the code for the first time it creates the table in database
but when I try to overwrite it by running the code again it gives me an
error.

/////This is the first try(generates tables properly)//////

C:\ruby\Crystallizer1>ruby murrayTest.rb
created table audit_trail_entries
created Ruby class for AuditTrailEntry
created table work_list_items
created Ruby class for WorkListItem
Changes stored persistently!
Done!

//////Trying to overwrite the table in the database///////

C:\ruby\Crystallizer1>ruby murrayTest.rb
created table audit_trail_entries
created Ruby class for AuditTrailEntry
c:/Program Files/ruby/lib/ruby/1.8/mysql.rb:1032:in sync=': closed stream (IOEr ror) from c:/Program Files/ruby/lib/ruby/1.8/mysql.rb:1032:inwrite’
from c:/Program Files/ruby/lib/ruby/1.8/mysql.rb:1092:in
finalizer' from ./nxw-persistency-0.2/nxw-persistency-0.2.rb:22:incall’
from ./nxw-persistency-0.2/nxw-persistency-0.2.rb:22
from c:/Program
Files/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.1/li
b/active_support/dependencies.rb:488:in load' from c:/Program Files/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.1/li b/active_support/dependencies.rb:488:inload’
from c:/Program
Files/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.1/li
b/active_support/dependencies.rb:342:in new_constants_in' from c:/Program Files/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.1/li b/active_support/dependencies.rb:488:inload’
from ./persistencyDSL.rb:75:in `domain_object_class’
from murrayTest.rb:32

I ll appreciate your help
Thank you