Create Temporary Sqlite in Memory

I need to create a temporary, in memory, Sqlite3 database... plus I
want all the AR goodness to go with. Oh, and I don't want to affect
existing AR models or schemas.

I'm close, but I don't know how to create a schema just for my
temporary database so that it won't affect other model's schemas. In
other words, I only want this schema/model to be active during a
single method execution.

    class PlsTemp < ActiveRecord::Base; end
    PlsTemp.establish_connection(:adapter => "sqlite3", :database =>
":memory:" )

How to I create the schema for PlsTemp?

I gave up. Not sure this can even be done in AR, at least not without
a fair amount of custom sql.

Went with creating a temporary table in production database
(postgresql). Not as fast as sqlite/memory, but acceptable.

Have you considered ActiveRecord::Migration? You might also look at the code for the db:schema:load rake task.

HTH