help with temporary database tables

I'm running Ruby 1.9.2 and Rails 3.0.7. I'm having problems inserting
data into a temporary database table.

I can create a temporary table with the code:
class TempHelper
  def self.create_temp
      ActiveRecord::Schema.define do
        create_table (:temps), :temporary => true do |t|
          t.string :name
          t.string :value
      return true
    rescue Exception => err
      return err.message

But I can not insert any data into it:
irb(main):001:0> TempHelper.create_temp
-- create_table(:temps, {:temporary=>true})
   -> 0.0440s
=> true
irb(main):002:0> Temp.count
=> 0
irb(main):003:0> t = => 'name', :value => 'value')
=> #<Temp id: nil, name: "name", value: "value">
NoMethodError: undefined method `name' for nil:NilClass
        from /usr/local/ruby-1.9.2/lib/ruby/gems/1.9.1/gems/
irb(main):005:0> t.class
=> Temp(Table doesn't exist)

I can provide the complete traceback if it will help.

I do not understand why this is not working. For this testing, I'm
using sqlite3. Is that the problem?

Thanx in advance.

It's now been a month since I made this post and have not received a

I am assuming that is because the only way to use temporary database
tables from Ruby is to write raw SQL.

or because not every person reads every message.

Nosing it around it appears that, for mysql and sqlite3 temporary
tables don't appear in the thing rails uses to decide whether a table
exists, so rails will refuse to believe that the table exists, which I
imagine is the root of the problem



Thank you so very much for your response.

If I am understanding you correctly, you are confirming my conclusion
that the only way to use temporary tables with sqlite3 and mysql is to
use raw SQL.