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.