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: <code> class TempHelper   def self.create_temp     begin       ActiveRecord::Schema.define do         create_table (:temps), :temporary => true do |t|           t.string :name           t.string :value         end       end       return true     rescue Exception => err       return err.message     end   end end </code>

But I can not insert any data into it: <code> 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 = Temp.new(:name => 'name', :value => 'value') => #<Temp id: nil, name: "name", value: "value"> irb(main):004:0> t.save NoMethodError: undefined method `name' for nil:NilClass         from /usr/local/ruby-1.9.2/lib/ruby/gems/1.9.1/gems/ activesupport-3.0.7/lib/active_support/whiny_nil.rb:48:in `method_missing'   ... irb(main):005:0> t.class => Temp(Table doesn't exist) </code>

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 response.

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

Fred

Fred,

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.